From 77fc2d05519d1b5ebf4f2b1be83d9af5e3b43a11 Mon Sep 17 00:00:00 2001 From: Marcin Wieczorek Date: Thu, 7 Jan 2016 23:58:14 +0100 Subject: [PATCH] Loading and saving ranks with commands. Ranks added to autosave Missing translations (#51) --- .../novaguilds/command/admin/CommandAdminReload.java | 4 ++++ .../marcin/novaguilds/command/admin/CommandAdminSave.java | 6 ++++++ src/main/java/co/marcin/novaguilds/enums/Message.java | 2 ++ .../java/co/marcin/novaguilds/manager/RankManager.java | 2 ++ .../co/marcin/novaguilds/runnable/RunnableAutoSave.java | 1 + src/main/resources/lang/de-de.yml | 6 ++++-- src/main/resources/lang/en-en.yml | 8 +++++--- src/main/resources/lang/pl-pl.yml | 6 ++++-- src/main/resources/lang/zh-cn.yml | 8 +++++--- 9 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/main/java/co/marcin/novaguilds/command/admin/CommandAdminReload.java b/src/main/java/co/marcin/novaguilds/command/admin/CommandAdminReload.java index a4f73aa8..2d805b3e 100644 --- a/src/main/java/co/marcin/novaguilds/command/admin/CommandAdminReload.java +++ b/src/main/java/co/marcin/novaguilds/command/admin/CommandAdminReload.java @@ -93,6 +93,10 @@ else if(plugin.getConfigManager().getDataStorageType() == DataStorageType.SQLITE plugin.getGroupManager().load(); Message.CHAT_RELOAD_GROUPS.send(sender); + //ranks + plugin.getRankManager().load(); + Message.CHAT_RELOAD_RANKS.send(sender); + LoggerUtils.info("Post checks running"); plugin.getGuildManager().postCheck(); plugin.getRegionManager().postCheck(); diff --git a/src/main/java/co/marcin/novaguilds/command/admin/CommandAdminSave.java b/src/main/java/co/marcin/novaguilds/command/admin/CommandAdminSave.java index a3548c0c..715c76fc 100644 --- a/src/main/java/co/marcin/novaguilds/command/admin/CommandAdminSave.java +++ b/src/main/java/co/marcin/novaguilds/command/admin/CommandAdminSave.java @@ -60,6 +60,11 @@ public void execute(CommandSender sender, String[] args) { Message.CHAT_ADMIN_SAVE_REGIONS.send(sender); LoggerUtils.info("Saved regions"); break; + case "ranks": + plugin.getRankManager().save(); + Message.CHAT_ADMIN_SAVE_RANKS.send(sender); + LoggerUtils.info("Saved ranks"); + break; default: Message.CHAT_INVALIDPARAM.send(sender); break; @@ -69,6 +74,7 @@ public void execute(CommandSender sender, String[] args) { plugin.getRegionManager().save(); plugin.getGuildManager().save(); plugin.getPlayerManager().save(); + plugin.getRankManager().save(); Message.CHAT_ADMIN_SAVE_ALL.send(sender); LoggerUtils.info("Saved all data"); } diff --git a/src/main/java/co/marcin/novaguilds/enums/Message.java b/src/main/java/co/marcin/novaguilds/enums/Message.java index fecc9250..1f0cc8b4 100644 --- a/src/main/java/co/marcin/novaguilds/enums/Message.java +++ b/src/main/java/co/marcin/novaguilds/enums/Message.java @@ -95,6 +95,7 @@ public enum Message { CHAT_ADMIN_SAVE_PLAYERS, CHAT_ADMIN_SAVE_GUILDS, CHAT_ADMIN_SAVE_REGIONS, + CHAT_ADMIN_SAVE_RANKS, CHAT_ADMIN_SAVE_ALL, CHAT_ADMIN_SAVE_AUTOSAVE, @@ -116,6 +117,7 @@ public enum Message { CHAT_RELOAD_REGIONS, CHAT_RELOAD_NEWMSGFILE, CHAT_RELOAD_GROUPS, + CHAT_RELOAD_RANKS, CHAT_RELOAD_RELOADED, CHAT_PVP_TEAM, diff --git a/src/main/java/co/marcin/novaguilds/manager/RankManager.java b/src/main/java/co/marcin/novaguilds/manager/RankManager.java index cb4a91cf..485f6b89 100644 --- a/src/main/java/co/marcin/novaguilds/manager/RankManager.java +++ b/src/main/java/co/marcin/novaguilds/manager/RankManager.java @@ -45,6 +45,8 @@ public class RankManager { private final List defaultRanks = new ArrayList<>(); public void load() { + defaultRanks.clear(); + //Load default ranks loadDefaultRanks(); diff --git a/src/main/java/co/marcin/novaguilds/runnable/RunnableAutoSave.java b/src/main/java/co/marcin/novaguilds/runnable/RunnableAutoSave.java index f432a162..6efbaddc 100644 --- a/src/main/java/co/marcin/novaguilds/runnable/RunnableAutoSave.java +++ b/src/main/java/co/marcin/novaguilds/runnable/RunnableAutoSave.java @@ -35,6 +35,7 @@ public void run() { plugin.getGuildManager().save(); plugin.getRegionManager().save(); plugin.getPlayerManager().save(); + plugin.getRankManager().save(); LoggerUtils.info("Saved data."); //send message to admins diff --git a/src/main/resources/lang/de-de.yml b/src/main/resources/lang/de-de.yml index 45196d27..8243582c 100644 --- a/src/main/resources/lang/de-de.yml +++ b/src/main/resources/lang/de-de.yml @@ -75,7 +75,8 @@ chat: players: "Spieler gespeichert." guilds: "Gilden gespeichert." regions: "Bereiche gespeichert." - all: "Alle Daten gespeichert. (Spieler, Bereiche, Gilden)" + ranks: "Ranks saved." + all: "Alle Daten gespeichert. (Spieler, Bereiche, Gilden, Ranks)" autosave: "Automatisches Speichern abgeschlossen." hologram: notfound: "Es wurde kein Hologramm mit diesem Namen gefunden." @@ -101,6 +102,7 @@ chat: regions: "Bereiche geladen!" newmsgfile: "Neue Nachrichten-Datei erstellt!" groups: "Gruppen geladen!" + ranks: "Ranks loaded!" reloaded: "NovaGuilds neu geladen!" usage: @@ -129,7 +131,7 @@ chat: - "&5* &7/nga &cg &2- &3Gildenbefehle" - "&5* &7/nga &ch &2- &3Hologrammbefehle" - "&5* &7/nga &creload &2- &6[&5NovaGuilds&6] &3neu laden" - - "&5* &7/nga &csave &6[players/guilds/region] &2- &3Daten Speichern" + - "&5* &7/nga &csave &6[players/guilds/regions/ranks] &2- &3Daten Speichern" region: header: "Admin Gebiet Befehle:" items: diff --git a/src/main/resources/lang/en-en.yml b/src/main/resources/lang/en-en.yml index 2799185d..e49387d4 100644 --- a/src/main/resources/lang/en-en.yml +++ b/src/main/resources/lang/en-en.yml @@ -75,7 +75,8 @@ chat: players: "Players saved." guilds: "Guilds saved." regions: "Regions saved." - all: "All data saved. (Players, Regions, Guilds)" + ranks: "Ranks saved." + all: "All data saved. (Players, Regions, Guilds, Ranks)" autosave: "AutoSave completed." hologram: notfound: "Could not find a hologram with this name." @@ -100,7 +101,8 @@ chat: guilds: "Guilds loaded!" regions: "Regions loaded!" newmsgfile: "New messages file created!" - groups: "Groups loaded" + groups: "Groups loaded!" + ranks: "Ranks loaded!" reloaded: "NovaGuilds reloaded!" usage: @@ -129,7 +131,7 @@ chat: - "&5* &7/nga &cg &2- &3Guild commands" - "&5* &7/nga &ch &2- &3Hologram commands" - "&5* &7/nga &creload &2- &3Reload &6[&5NovaGuilds&6]" - - "&5* &7/nga &csave &6[players/guilds/regions] &2- &3Save data" + - "&5* &7/nga &csave &6[players/guilds/regions/ranks] &2- &3Save data" region: header: "Admin region commands:" items: diff --git a/src/main/resources/lang/pl-pl.yml b/src/main/resources/lang/pl-pl.yml index 9ea30d9e..86ca2b2d 100644 --- a/src/main/resources/lang/pl-pl.yml +++ b/src/main/resources/lang/pl-pl.yml @@ -75,7 +75,8 @@ chat: players: "Gracze zapisani." guilds: "Gildie zapisane." regions: "Regiony zapisane." - all: "Zapisano wszystkie dane. (Gracze, gildie, regiony)" + ranks: "Rangi zapisane." + all: "Zapisano wszystkie dane. (Gracze, gildie, regiony, rangi)" autosave: "Zakonczono automatyczny zapis." hologram: notfound: "Nie udalo sie znalezc hologramu o takiej nazwie." @@ -101,6 +102,7 @@ chat: regions: "Regiony zaladowane" newmsgfile: "Nowy plik wiadomosci stworzony!" groups: "Grupy zaladowane!" + ranks: "Rangi załadowane!" reloaded: "NovaGuilds przeladowane!" usage: @@ -129,7 +131,7 @@ chat: - "&5* &7/nga &cg &2- &3Komendy gildii" - "&5* &7/nga &ch &2- &3Komendy hologramow" - "&5* &7/nga &creload &2- &3Przeladuj &6[&5NovaGuilds&6]" - - "&5* &7/nga &csave &6[players/guilds/regions] &2- &3Zapisz dane" + - "&5* &7/nga &csave &6[players/guilds/regions/ranks] &2- &3Zapisz dane" region: header: "Komendy Admina, regiony:" items: diff --git a/src/main/resources/lang/zh-cn.yml b/src/main/resources/lang/zh-cn.yml index 48de9338..1af7cc6c 100644 --- a/src/main/resources/lang/zh-cn.yml +++ b/src/main/resources/lang/zh-cn.yml @@ -75,7 +75,8 @@ chat: players: "玩家数据已保存." guilds: "公会数据已保存." regions: "领地数据已保存." - all: "配置文件已保存(Players, Regions, Guilds)" + ranks: "Ranks saved." + all: "配置文件已保存(Players, Regions, Guilds, Ranks)" autosave: "自动保存传送." hologram: notfound: "找不到该名称的全息图" @@ -100,7 +101,8 @@ chat: guilds: "公会数据已重载!" regions: "领地数据已重载!" newmsgfile: "成功创建新语言文件!" - groups: "权限组信息已加载" + groups: "权限组信息已加载!" + ranks: "Ranks loaded!" reloaded: "插件重载完成!" usage: @@ -129,7 +131,7 @@ chat: - "&5* &7/nga &cg &2- &3公会管理指令" - "&5* &7/nga &ch &2- &3全息图指令" - "&5* &7/nga &creload &2- &3重载 &6[&5NovaGuilds&6]" - - "&5* &7/nga &csave &6[players/guilds/regions] &2- &3保存公会插件数据" + - "&5* &7/nga &csave &6[players/guilds/regions/ranks] &2- &3保存公会插件数据" region: header: "[管理]领地管理指令:" items: