From 3d2f4d710a8512581d1cf80ae8cef240fbf463fc Mon Sep 17 00:00:00 2001 From: Zrips Date: Wed, 22 Jun 2022 15:51:48 +0300 Subject: [PATCH] Locale cleanup. We can use most common things from CMILib locale --- .../com/gamingmesh/jobs/Gui/GuiManager.java | 7 ++-- src/main/java/com/gamingmesh/jobs/Jobs.java | 17 +++++---- .../jobs/Placeholders/Placeholder.java | 7 ++-- .../jobs/commands/JobsCommands.java | 12 +++--- .../gamingmesh/jobs/commands/list/area.java | 4 +- .../jobs/commands/list/blockinfo.java | 4 +- .../gamingmesh/jobs/commands/list/bonus.java | 4 +- .../com/gamingmesh/jobs/commands/list/bp.java | 4 +- .../jobs/commands/list/clearownership.java | 5 ++- .../jobs/commands/list/convert.java | 5 ++- .../jobs/commands/list/edititembonus.java | 4 +- .../jobs/commands/list/editpoints.java | 5 ++- .../jobs/commands/list/fireall.java | 5 ++- .../gamingmesh/jobs/commands/list/gtop.java | 4 +- .../gamingmesh/jobs/commands/list/info.java | 7 +++- .../jobs/commands/list/itembonus.java | 4 +- .../jobs/commands/list/iteminfo.java | 4 +- .../gamingmesh/jobs/commands/list/join.java | 6 ++- .../gamingmesh/jobs/commands/list/leave.java | 5 ++- .../jobs/commands/list/leaveall.java | 5 ++- .../gamingmesh/jobs/commands/list/limit.java | 9 +++-- .../gamingmesh/jobs/commands/list/log.java | 5 ++- .../jobs/commands/list/ownedblocks.java | 3 +- .../gamingmesh/jobs/commands/list/points.java | 5 ++- .../gamingmesh/jobs/commands/list/quests.java | 7 +++- .../gamingmesh/jobs/commands/list/shop.java | 5 ++- .../gamingmesh/jobs/commands/list/stats.java | 4 +- .../gamingmesh/jobs/commands/list/toggle.java | 5 ++- .../gamingmesh/jobs/commands/list/top.java | 6 ++- .../jobs/config/LanguageManager.java | 26 ------------- .../gamingmesh/jobs/config/ShopManager.java | 5 ++- .../jobs/container/JobProgression.java | 4 +- .../gamingmesh/jobs/container/JobsPlayer.java | 3 +- .../jobs/listeners/JobsListener.java | 4 +- .../com/gamingmesh/jobs/stuff/TimeManage.java | 38 ------------------- 35 files changed, 128 insertions(+), 119 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java index 356cbb80..e5c85f4b 100644 --- a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java +++ b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java @@ -24,6 +24,7 @@ import net.Zrips.CMILib.CMILib; import net.Zrips.CMILib.GUI.CMIGui; import net.Zrips.CMILib.GUI.CMIGuiButton; import net.Zrips.CMILib.GUI.GUIManager.GUIClickType; +import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Version.Version; public class GuiManager { @@ -340,7 +341,7 @@ public class GuiManager { ItemStack back = Jobs.getGCManager().guiBackButton; ItemMeta meta = back.getItemMeta(); - meta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back")); + meta.setDisplayName(LC.info_prevPageHover.getLocale()); back.setItemMeta(meta); gui.addButton(new CMIGuiButton(backButton, back) { @@ -355,7 +356,7 @@ public class GuiManager { ItemStack next = Jobs.getGCManager().guiNextButton; ItemMeta meta = next.getItemMeta(); - meta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.next")); + meta.setDisplayName(LC.info_nextPageHover.getLocale()); next.setItemMeta(meta); gui.addButton(new CMIGuiButton(nextButton, next) { @@ -490,7 +491,7 @@ public class GuiManager { ItemStack skull = Jobs.getGCManager().guiBackButton; ItemMeta skullMeta = skull.getItemMeta(); - skullMeta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back")); + skullMeta.setDisplayName(LC.info_prevPageHover.getLocale()); skull.setItemMeta(skullMeta); gui.addButton(new CMIGuiButton(backButton, skull) { diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index 0fde683a..9dc6bbfb 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -115,6 +115,7 @@ import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; @@ -1455,10 +1456,10 @@ public final class Jobs extends JavaPlugin { return true; if (!rawEnable) { - ((Player) sender).sendMessage(lManager.getMessage("general.error.permission")); + CMIMessages.sendMessage(sender, LC.info_NoPermission); return false; } - new RawMessage().addText(lManager.getMessage("general.error.permission")).addHover("&2" + perm).show((Player) sender); + new RawMessage().addText(LC.info_NoPermission.getLocale()).addHover("&2" + perm).show((Player) sender); return false; } @@ -1492,15 +1493,15 @@ public final class Jobs extends JavaPlugin { } RawMessage rm = new RawMessage() - .addText((currentPage > 1 ? lManager.getMessage("command.help.output.prevPage") : lManager.getMessage("command.help.output.prevPageOff"))) - .addHover(currentPage > 1 ? "<<<" : ">|") + .addText((currentPage > 1 ? LC.info_prevPage.getLocale() : LC.info_prevPageOff.getLocale())) + .addHover(currentPage > 1 ? LC.info_prevPageHover.getLocale() : LC.info_lastPageHover.getLocale()) .addCommand(currentPage > 1 ? cmd + " " + pagePrefix + prevpage : cmd + " " + pagePrefix + pageCount); - rm.addText(lManager.getMessage("command.help.output.pageCount", "[current]", currentPage, "[total]", pageCount)) - .addHover(lManager.getMessage("command.help.output.pageCountHover", "[totalEntries]", totalEntries)); + rm.addText(LC.info_pageCount.getLocale("[current]", currentPage, "[total]", pageCount)) + .addHover(LC.info_pageCountHover.getLocale("[totalEntries]", totalEntries)); - rm.addText(pageCount > currentPage ? lManager.getMessage("command.help.output.nextPage") : lManager.getMessage("command.help.output.nextPageOff")) - .addHover(pageCount > currentPage ? ">>>" : "|<") + rm.addText(pageCount > currentPage ? LC.info_nextPage.getLocale() : LC.info_nextPageOff.getLocale()) + .addHover(pageCount > currentPage ? LC.info_nextPageHover.getLocale(): LC.info_firstPageHover.getLocale()) .addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1); if (pageCount != 0) diff --git a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java index 0328a11e..74ae5801 100644 --- a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java +++ b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java @@ -32,6 +32,7 @@ import com.gamingmesh.jobs.stuff.TimeManage; import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Container.CMIList; import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Time.CMITimeManager; public class Placeholder { @@ -448,7 +449,7 @@ public class Placeholder { case user_doneq: return Integer.toString(user.getDoneQuests()); case user_seen: - return TimeManage.to24hourShort(System.currentTimeMillis() - user.getSeen()); + return CMITimeManager.to24hourShort(System.currentTimeMillis() - user.getSeen()); case user_totallevels: return Integer.toString(user.getTotalLevels()); case user_points: @@ -506,7 +507,7 @@ public class Placeholder { case plimit_$1: return Double.toString(user.getPaymentLimit().getAmount(CurrencyType.getByName(keyValue))); case plimit_tleft_$1: - return TimeManage.to24hourShort(user.getPaymentLimit().getLeftTime(CurrencyType.getByName(keyValue))); + return CMITimeManager.to24hourShort(user.getPaymentLimit().getLeftTime(CurrencyType.getByName(keyValue))); case user_jlevel_$1: return j == null ? "0" : j.getLevelFormatted(); case user_jexp_$1: @@ -666,6 +667,6 @@ public class Placeholder { } private static String convert(boolean state) { - return Jobs.getLanguage().getMessage("general.info." + (state ? "true" : "false")); + return state ? LC.info_variables_True.getLocale() : LC.info_variables_False.getLocale(); } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java index 6e931f66..a4e29c7b 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java @@ -25,7 +25,9 @@ import com.gamingmesh.jobs.stuff.Util; import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Logs.CMIDebug; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; public class JobsCommands implements CommandExecutor { @@ -63,7 +65,7 @@ public class JobsCommands implements CommandExecutor { try { page = Integer.parseInt(args[1]); } catch (NumberFormatException e) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber")); + CMIMessages.sendMessage(sender, LC.info_UseInteger); return true; } return help(sender, page); @@ -72,16 +74,16 @@ public class JobsCommands implements CommandExecutor { String cmd = args[0].toLowerCase(); Cmd cmdClass = getCmdClass(cmd); if (cmdClass == null) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noCommand")); + CMIMessages.sendMessage(sender, LC.info_NoCommand); return true; } if (!hasCommandPermission(sender, cmd)) { if (sender instanceof Player) { - new RawMessage().addText(Jobs.getLanguage().getMessage("general.error.permission")) + new RawMessage().addText(LC.info_NoPermission.getLocale()) .addHover("&2" + label + ".command." + cmd).show(sender); } else - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); + CMIMessages.sendMessage(sender, LC.info_NoPermission); return true; } @@ -120,7 +122,7 @@ public class JobsCommands implements CommandExecutor { protected boolean help(CommandSender sender, int page) { Set commands = getCommands(sender); if (commands.isEmpty()) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); + CMIMessages.sendMessage(sender, LC.info_NoPermission); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/area.java b/src/main/java/com/gamingmesh/jobs/commands/list/area.java index d41d3f78..30637c39 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/area.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/area.java @@ -14,13 +14,15 @@ import com.gamingmesh.jobs.container.RestrictedArea; import com.gamingmesh.jobs.hooks.HookManager; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; public class area implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java b/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java index f8ae03bf..2aa7c03d 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java @@ -9,6 +9,8 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.stuff.Util; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.Version.Version; @@ -18,7 +20,7 @@ public class blockinfo implements Cmd { @SuppressWarnings("deprecation") public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java b/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java index 9d26e1f4..f176ed45 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java @@ -14,6 +14,8 @@ import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.hooks.HookManager; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; public class bonus implements Cmd { @@ -21,7 +23,7 @@ public class bonus implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/bp.java b/src/main/java/com/gamingmesh/jobs/commands/list/bp.java index 368869a5..44d7db87 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/bp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/bp.java @@ -15,6 +15,8 @@ import com.gamingmesh.jobs.container.BlockProtection; import com.gamingmesh.jobs.container.DBAction; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Version.Version; public class bp implements Cmd { @@ -24,7 +26,7 @@ public class bp implements Cmd { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } boolean all = false; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/clearownership.java b/src/main/java/com/gamingmesh/jobs/commands/list/clearownership.java index d1658b5d..1d8b242d 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/clearownership.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/clearownership.java @@ -8,6 +8,9 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class clearownership implements Cmd { @Override @@ -33,7 +36,7 @@ public class clearownership implements Cmd { if (jPlayer == null) { if (args.length >= 1) - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); + CMIMessages.sendMessage(sender, LC.info_NoInformation); else Jobs.getCommandManager().sendUsage(sender, "clearownership"); return true; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/convert.java b/src/main/java/com/gamingmesh/jobs/commands/list/convert.java index 978d7ebc..0d691d78 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/convert.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/convert.java @@ -8,12 +8,15 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.dao.JobsManager.DataBaseType; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class convert implements Cmd { @Override public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (sender instanceof Player) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.fromconsole")); + CMIMessages.sendMessage(sender, LC.info_FromConsole); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java b/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java index 1d733502..19a314c4 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java @@ -16,6 +16,8 @@ import com.gamingmesh.jobs.container.JobsPlayer; import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.NBT.CMINBT; public class edititembonus implements Cmd { @@ -35,7 +37,7 @@ public class edititembonus implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java b/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java index c1e50903..05c3aed8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java @@ -6,6 +6,9 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.PlayerPoints; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class editpoints implements Cmd { @Override @@ -25,7 +28,7 @@ public class editpoints implements Cmd { try { amount = Double.parseDouble(args[2]); } catch (NumberFormatException e) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber")); + CMIMessages.sendMessage(sender, LC.info_UseInteger); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/fireall.java b/src/main/java/com/gamingmesh/jobs/commands/list/fireall.java index 8cd1c209..05c5442e 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/fireall.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/fireall.java @@ -9,6 +9,9 @@ import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.dao.JobsDAO.DBTables; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class fireall implements Cmd { @Override @@ -20,7 +23,7 @@ public class fireall implements Cmd { if (args[0].equalsIgnoreCase("all")) { if (sender instanceof Player) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.fromconsole")); + CMIMessages.sendMessage(sender, LC.info_FromConsole); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java b/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java index 0ac0838b..b72f81c8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java @@ -12,6 +12,8 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.TopList; import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Scoreboards.CMIScoreboard; public class gtop implements Cmd { @@ -19,7 +21,7 @@ public class gtop implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/info.java b/src/main/java/com/gamingmesh/jobs/commands/list/info.java index 6202d92a..7143fa6d 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/info.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/info.java @@ -9,13 +9,16 @@ import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class info implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } @@ -39,7 +42,7 @@ public class info implements Cmd { } if (Jobs.getGCManager().hideJobsInfoWithoutPermission && !Jobs.getCommandManager().hasJobPermission(pSender, job)) { - pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); + CMIMessages.sendMessage(pSender, LC.info_NoPermission); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java b/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java index 9cab637e..6e247260 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java @@ -20,6 +20,8 @@ import com.gamingmesh.jobs.container.JobsPlayer; import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; public class itembonus implements Cmd { @@ -27,7 +29,7 @@ public class itembonus implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java b/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java index 0391a92d..3cf23e5e 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java @@ -10,6 +10,8 @@ import com.gamingmesh.jobs.commands.Cmd; import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.Version.Version; @@ -19,7 +21,7 @@ public class iteminfo implements Cmd { @SuppressWarnings("deprecation") public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/join.java b/src/main/java/com/gamingmesh/jobs/commands/list/join.java index 3b1d737f..048b8a8c 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/join.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/join.java @@ -9,6 +9,8 @@ import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; public class join implements Cmd { @@ -16,7 +18,7 @@ public class join implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } @@ -39,7 +41,7 @@ public class join implements Cmd { if (!Jobs.getCommandManager().hasJobPermission(sender, job)) { // The player do not have permission to join the job - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); + CMIMessages.sendMessage(sender, LC.info_NoPermission); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/leave.java b/src/main/java/com/gamingmesh/jobs/commands/list/leave.java index 1fd791d7..b097c468 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/leave.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/leave.java @@ -9,6 +9,9 @@ import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class leave implements Cmd { @Override @@ -29,7 +32,7 @@ public class leave implements Cmd { } if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + args[0].toLowerCase())) { - pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); + CMIMessages.sendMessage(pSender, LC.info_NoPermission); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java b/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java index db080963..7b3c9e7f 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java @@ -11,12 +11,15 @@ import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class leaveall implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/limit.java b/src/main/java/com/gamingmesh/jobs/commands/list/limit.java index b13db3b1..8bacf748 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/limit.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/limit.java @@ -8,7 +8,10 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.economy.PaymentData; -import com.gamingmesh.jobs.stuff.TimeManage; + +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; +import net.Zrips.CMILib.Time.CMITimeManager; public class limit implements Cmd { @@ -40,7 +43,7 @@ public class limit implements Cmd { if (JPlayer == null) { if (args.length >= 1) - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); + CMIMessages.sendMessage(sender, LC.info_NoInformation); else if (!(sender instanceof Player)) Jobs.getCommandManager().sendUsage(sender, "limit"); return true; @@ -57,7 +60,7 @@ public class limit implements Cmd { if (limit.getLeftTime(type) > 0) { String typeName = type.getName().toLowerCase(); - sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + typeName + "time", "%time%", TimeManage.to24hourShort(limit.getLeftTime(type)))); + sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + typeName + "time", "%time%", CMITimeManager.to24hourShort(limit.getLeftTime(type)))); sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + typeName + "Limit", "%current%", (int) (limit.getAmount(type) * 100) / 100D, "%total%", JPlayer.getLimit(type))); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/log.java b/src/main/java/com/gamingmesh/jobs/commands/list/log.java index 78dd37e3..33728b09 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/log.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/log.java @@ -17,12 +17,15 @@ import com.gamingmesh.jobs.container.Log; import com.gamingmesh.jobs.container.LogAmounts; import com.gamingmesh.jobs.stuff.Sorting; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class log implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player) && args.length != 1) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/ownedblocks.java b/src/main/java/com/gamingmesh/jobs/commands/list/ownedblocks.java index 82f31bfd..31624d61 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/ownedblocks.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/ownedblocks.java @@ -20,6 +20,7 @@ import net.Zrips.CMILib.Container.CMILocation; import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.Snd; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; public class ownedblocks implements Cmd { @@ -36,7 +37,7 @@ public class ownedblocks implements Cmd { if (jPlayer == null) { if (args.length >= 1) - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); + CMIMessages.sendMessage(sender, LC.info_NoInformation); else Jobs.getCommandManager().sendUsage(sender, "ownedblocks"); return true; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/points.java b/src/main/java/com/gamingmesh/jobs/commands/list/points.java index 204bd50a..6800b743 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/points.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/points.java @@ -8,6 +8,9 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.PlayerPoints; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class points implements Cmd { @Override @@ -30,7 +33,7 @@ public class points implements Cmd { if (jPlayer == null) { if (args.length >= 1) - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); + CMIMessages.sendMessage(sender, LC.info_NoInformation); else Jobs.getCommandManager().sendUsage(sender, "points"); return true; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java index 4922ddfb..56920dbc 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -16,7 +16,10 @@ import com.gamingmesh.jobs.container.QuestObjective; import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.stuff.TimeManage; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; +import net.Zrips.CMILib.Time.CMITimeManager; public class quests implements Cmd { @@ -35,7 +38,7 @@ public class quests implements Cmd { if (jPlayer == null) { if (args.length >= 1) - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); + CMIMessages.sendMessage(sender, LC.info_NoInformation); else Jobs.getCommandManager().sendUsage(sender, "quests"); return true; @@ -102,7 +105,7 @@ public class quests implements Cmd { for (String current : hoverMsg.split("\n")) { current = current.replace("[jobName]", jobProg.getJob().getName()) - .replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis())); + .replace("[time]", CMITimeManager.to24hourShort(q.getValidUntil() - System.currentTimeMillis())); if (current.contains("[desc]")) { hoverList.addAll(quest.getDescription()); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/shop.java b/src/main/java/com/gamingmesh/jobs/commands/list/shop.java index 7771d5d8..2b4ceb9b 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/shop.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/shop.java @@ -5,13 +5,16 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class shop implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java index c07c8b76..3ac24194 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java @@ -9,6 +9,8 @@ import com.gamingmesh.jobs.commands.JobsCommands; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.RawMessages.RawMessage; public class stats implements Cmd { @@ -26,7 +28,7 @@ public class stats implements Cmd { if (jPlayer == null) { if (args.length >= 1) - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); + CMIMessages.sendMessage(sender, LC.info_NoInformation); else Jobs.getCommandManager().sendUsage(sender, "stats"); return true; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/toggle.java b/src/main/java/com/gamingmesh/jobs/commands/list/toggle.java index c95d48ce..3aa83c9e 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/toggle.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/toggle.java @@ -9,12 +9,15 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.ToggleBarHandling; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + public class toggle implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/top.java b/src/main/java/com/gamingmesh/jobs/commands/list/top.java index ee6ac9f2..85c49159 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/top.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/top.java @@ -13,6 +13,8 @@ import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.TopList; import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Scoreboards.CMIScoreboard; public class top implements Cmd { @@ -20,7 +22,7 @@ public class top implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); + CMIMessages.sendMessage(sender, LC.info_Ingame); return false; } @@ -58,7 +60,7 @@ public class top implements Cmd { List fullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart()); if (fullList.isEmpty()) { - player.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); + CMIMessages.sendMessage(sender, LC.info_NoInformation); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index aaf2f487..73cc6da4 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -79,13 +79,7 @@ public class LanguageManager { c.get("limitedItem.error.levelup", "&cYou need to level up in [jobname] to use this item!"); c.get("general.info.toplineseparator", "&7*********************** &6%playerdisplayname% &7***********************"); c.get("general.info.separator", "&7*******************************************************"); - c.get("general.info.time.days", "&e%days% &6days "); - c.get("general.info.time.hours", "&e%hours% &6hours "); - c.get("general.info.time.mins", "&e%mins% &6min "); - c.get("general.info.time.secs", "&e%secs% &6sec "); c.get("general.info.invalidPage", "&cInvalid page"); - c.get("general.info.true", "&2True"); - c.get("general.info.false", "&cFalse"); c.get("general.info.blocks.furnace", "Furnace"); c.get("general.info.blocks.smoker", "Smoker"); c.get("general.info.blocks.blastfurnace", "Blast furnace"); @@ -93,15 +87,9 @@ public class LanguageManager { c.get("general.admin.error", "&cThere was an error in the command."); c.get("general.admin.success", "&eYour command has been performed."); c.get("general.error.noHelpPage", "&cThere is no help page by this number!"); - c.get("general.error.notNumber", "&ePlease use numbers!"); c.get("general.error.job", "&cThe job you selected does not exist or you not joined to this!"); - c.get("general.error.noCommand", "&cThere is no command by this name!"); - c.get("general.error.permission", "&cYou do not have permission to do that!"); - c.get("general.error.noinfo", "&cNo information found!"); c.addComment("general.error.noinfoByPlayer", "Only %playername% can be used here"); c.get("general.error.noinfoByPlayer", "&cNo information found by [%playername%] player name!"); - c.get("general.error.ingame", "&cYou can use this command only in game!"); - c.get("general.error.fromconsole", "&cYou can use this command only from console!"); c.get("general.error.worldisdisabled", "&cYou can't use command in this world!"); c.get("general.error.newRegistration", "&eRegistered new ownership for [block] &7[current]&e/&f[max]"); @@ -109,7 +97,6 @@ public class LanguageManager { c.get("general.error.noRegistration", "&cYou've reached max [block] count!"); c.get("general.error.blockDisabled", "&6Payments from &e[type] &6got disabled. &2[location]"); - c.get("command.help.output.info", "Type /jobs [cmd] ? for more information about a command."); c.get("command.help.output.cmdUsage", "&2Usage: &7[command]"); c.get("command.help.output.label", "Jobs"); @@ -118,17 +105,6 @@ public class LanguageManager { c.get("command.help.output.helpPageDescription", "&2* [description]"); c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------"); - c.get("command.help.output.page", "&e-----&e ====== Page &6[1] &eof &6[2] &e====== &e-----"); - c.get("command.help.output.fliperSimbols", "&e----------"); - - c.get("command.help.output.prevPage", "&2----<< &6Prev "); - c.get("command.help.output.prevPageOff", "&7----<< Prev "); - c.get("command.help.output.nextPage", "&6 Next &2>>----"); - c.get("command.help.output.nextPageOff", "&7 Next >>----"); - c.get("command.help.output.pageCount", "&2[current]/[total]"); - c.get("command.help.output.pageCountHover", "&e[totalEntries] entries"); - c.get("command.help.output.prevPageGui", "&6Previous page "); - c.get("command.help.output.nextPageGui", "&6Next Page"); c.get("command.moneyboost.help.info", "Boosts money gain for all players"); c.get("command.moneyboost.help.args", "[jobname]/all/reset [time]/[rate]"); @@ -381,8 +357,6 @@ public class LanguageManager { c.get("command.info.gui.working", "&2&nAlready working"); c.get("command.info.gui.cantJoin", "&cYou can't join to the selected job."); c.get("command.info.gui.max", "&eMax level:&f "); - c.get("command.info.gui.back", "&e<<< Back"); - c.get("command.info.gui.next", "&eNext >>>"); c.get("command.info.output.break.info", "&eBreak"); c.get("command.info.output.break.none", "%jobname% does not get money for breaking blocks."); diff --git a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java index 7626a4d4..ee63eb98 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java @@ -38,6 +38,7 @@ import net.Zrips.CMILib.GUI.CMIGuiButton; import net.Zrips.CMILib.GUI.GUIManager.GUIClickType; import net.Zrips.CMILib.GUI.GUIManager.GUIRows; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Version.Version; @SuppressWarnings("deprecation") @@ -271,7 +272,7 @@ public class ShopManager { int prevSlot = getPrevButtonSlot(guiSize.getFields(), page); if (prevSlot != -1 && page > 1) { - meta.setDisplayName(Jobs.getLanguage().getMessage("command.help.output.prevPage")); + meta.setDisplayName(LC.info_prevPage.getLocale()); item.setItemMeta(meta); gui.addButton(new CMIGuiButton(prevSlot, item) { @@ -284,7 +285,7 @@ public class ShopManager { int nextSlot = getNextButtonSlot(guiSize.getFields(), page); if (nextSlot != -1 && !getItemsByPage(page + 1).isEmpty()) { - meta.setDisplayName(Jobs.getLanguage().getMessage("command.help.output.nextPage")); + meta.setDisplayName(LC.info_nextPage.getLocale()); item.setItemMeta(meta); gui.addButton(new CMIGuiButton(nextSlot, item) { @Override diff --git a/src/main/java/com/gamingmesh/jobs/container/JobProgression.java b/src/main/java/com/gamingmesh/jobs/container/JobProgression.java index 0a846b36..ff5b258b 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobProgression.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobProgression.java @@ -25,6 +25,8 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.stuff.TimeManage; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Time.CMITimeManager; + public class JobProgression { private Job job; private JobsPlayer jPlayer; @@ -264,7 +266,7 @@ public class JobProgression { } public String getRejoinTimeMessage() { - return leftOn == null ? "" : TimeManage.to24hourShort(leftOn + job.getRejoinCd() - System.currentTimeMillis()); + return leftOn == null ? "" : CMITimeManager.to24hourShort(leftOn + job.getRejoinCd() - System.currentTimeMillis()); } public Double getLastExperience() { diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 99e9f93f..00115bdd 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -46,6 +46,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Equations.Parser; import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Logs.CMIDebug; +import net.Zrips.CMILib.Time.CMITimeManager; public class JobsPlayer { @@ -256,7 +257,7 @@ public class JobsPlayer { } if (data.isAnnounceTime(limit.getAnnouncementDelay()) && player.isOnline()) - CMIActionBar.send(player, Jobs.getLanguage().getMessage("command.limit.output." + name + "time", "%time%", TimeManage.to24hourShort(data.getLeftTime(type)))); + CMIActionBar.send(player, Jobs.getLanguage().getMessage("command.limit.output." + name + "time", "%time%", CMITimeManager.to24hourShort(data.getLeftTime(type)))); if (data.isReseted(type)) data.setReseted(type, false); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index d7e9410f..94fbb087 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -86,6 +86,8 @@ import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Items.ArmorTypes; import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.NBT.CMINBT; import net.Zrips.CMILib.Version.Version; @@ -294,7 +296,7 @@ public class JobsListener implements Listener { try { number = Integer.parseInt(numberString); } catch (NumberFormatException e) { - player.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber")); + CMIMessages.sendMessage(player, LC.info_UseInteger); return; } diff --git a/src/main/java/com/gamingmesh/jobs/stuff/TimeManage.java b/src/main/java/com/gamingmesh/jobs/stuff/TimeManage.java index cfdfdbc9..9410d2d5 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/TimeManage.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/TimeManage.java @@ -3,8 +3,6 @@ package com.gamingmesh.jobs.stuff; import java.text.SimpleDateFormat; import java.util.Calendar; -import com.gamingmesh.jobs.Jobs; - public class TimeManage { public static int timeInInt() { @@ -16,40 +14,4 @@ public class TimeManage { calendar.setTimeInMillis(time); return Integer.valueOf(new SimpleDateFormat("YYMMdd").format(calendar.getTime())); } - - public static String to24hourShort(Long ticks) { - long years = ticks / 1000 / 60 / 60 / 24 / 365; - ticks = ticks - (years * 1000 * 60 * 60 * 24 * 365); - - long days = ticks / 1000 / 60 / 60 / 24; - ticks = ticks - (days * 1000 * 60 * 60 * 24); - - long hours = ticks / 1000 / 60 / 60; - ticks = ticks - (hours * 1000 * 60 * 60); - - long minutes = ticks / 1000 / 60; - ticks = ticks - (minutes * 1000 * 60); - - long sec = ticks / 1000; - ticks = ticks - (sec * 1000); - - String time = ""; - - if (days > 0) - time += Jobs.getLanguage().getMessage("general.info.time.days", "%days%", days); - - if (hours > 0 || (minutes > 0 || sec > 0) && days != 0 && hours == 0) - time += Jobs.getLanguage().getMessage("general.info.time.hours", "%hours%", hours); - - if (minutes > 0 || sec > 0 && minutes == 0 && (hours != 0 || days != 0)) - time += Jobs.getLanguage().getMessage("general.info.time.mins", "%mins%", minutes); - - if (sec > 0) - time += Jobs.getLanguage().getMessage("general.info.time.secs", "%secs%", sec); - - if (time.isEmpty()) - time += Jobs.getLanguage().getMessage("general.info.time.secs", "%secs%", 0); - - return time; - } }