1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Locale cleanup. We can use most common things from CMILib locale

This commit is contained in:
Zrips 2022-06-22 15:51:48 +03:00
parent b48eb48ea9
commit 3d2f4d710a
35 changed files with 128 additions and 119 deletions

View File

@ -24,6 +24,7 @@ import net.Zrips.CMILib.CMILib;
import net.Zrips.CMILib.GUI.CMIGui; import net.Zrips.CMILib.GUI.CMIGui;
import net.Zrips.CMILib.GUI.CMIGuiButton; import net.Zrips.CMILib.GUI.CMIGuiButton;
import net.Zrips.CMILib.GUI.GUIManager.GUIClickType; import net.Zrips.CMILib.GUI.GUIManager.GUIClickType;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
public class GuiManager { public class GuiManager {
@ -340,7 +341,7 @@ public class GuiManager {
ItemStack back = Jobs.getGCManager().guiBackButton; ItemStack back = Jobs.getGCManager().guiBackButton;
ItemMeta meta = back.getItemMeta(); ItemMeta meta = back.getItemMeta();
meta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back")); meta.setDisplayName(LC.info_prevPageHover.getLocale());
back.setItemMeta(meta); back.setItemMeta(meta);
gui.addButton(new CMIGuiButton(backButton, back) { gui.addButton(new CMIGuiButton(backButton, back) {
@ -355,7 +356,7 @@ public class GuiManager {
ItemStack next = Jobs.getGCManager().guiNextButton; ItemStack next = Jobs.getGCManager().guiNextButton;
ItemMeta meta = next.getItemMeta(); ItemMeta meta = next.getItemMeta();
meta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.next")); meta.setDisplayName(LC.info_nextPageHover.getLocale());
next.setItemMeta(meta); next.setItemMeta(meta);
gui.addButton(new CMIGuiButton(nextButton, next) { gui.addButton(new CMIGuiButton(nextButton, next) {
@ -490,7 +491,7 @@ public class GuiManager {
ItemStack skull = Jobs.getGCManager().guiBackButton; ItemStack skull = Jobs.getGCManager().guiBackButton;
ItemMeta skullMeta = skull.getItemMeta(); ItemMeta skullMeta = skull.getItemMeta();
skullMeta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back")); skullMeta.setDisplayName(LC.info_prevPageHover.getLocale());
skull.setItemMeta(skullMeta); skull.setItemMeta(skullMeta);
gui.addButton(new CMIGuiButton(backButton, skull) { gui.addButton(new CMIGuiButton(backButton, skull) {

View File

@ -115,6 +115,7 @@ import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
@ -1455,10 +1456,10 @@ public final class Jobs extends JavaPlugin {
return true; return true;
if (!rawEnable) { if (!rawEnable) {
((Player) sender).sendMessage(lManager.getMessage("general.error.permission")); CMIMessages.sendMessage(sender, LC.info_NoPermission);
return false; 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; return false;
} }
@ -1492,15 +1493,15 @@ public final class Jobs extends JavaPlugin {
} }
RawMessage rm = new RawMessage() RawMessage rm = new RawMessage()
.addText((currentPage > 1 ? lManager.getMessage("command.help.output.prevPage") : lManager.getMessage("command.help.output.prevPageOff"))) .addText((currentPage > 1 ? LC.info_prevPage.getLocale() : LC.info_prevPageOff.getLocale()))
.addHover(currentPage > 1 ? "<<<" : ">|") .addHover(currentPage > 1 ? LC.info_prevPageHover.getLocale() : LC.info_lastPageHover.getLocale())
.addCommand(currentPage > 1 ? cmd + " " + pagePrefix + prevpage : cmd + " " + pagePrefix + pageCount); .addCommand(currentPage > 1 ? cmd + " " + pagePrefix + prevpage : cmd + " " + pagePrefix + pageCount);
rm.addText(lManager.getMessage("command.help.output.pageCount", "[current]", currentPage, "[total]", pageCount)) rm.addText(LC.info_pageCount.getLocale("[current]", currentPage, "[total]", pageCount))
.addHover(lManager.getMessage("command.help.output.pageCountHover", "[totalEntries]", totalEntries)); .addHover(LC.info_pageCountHover.getLocale("[totalEntries]", totalEntries));
rm.addText(pageCount > currentPage ? lManager.getMessage("command.help.output.nextPage") : lManager.getMessage("command.help.output.nextPageOff")) rm.addText(pageCount > currentPage ? LC.info_nextPage.getLocale() : LC.info_nextPageOff.getLocale())
.addHover(pageCount > currentPage ? ">>>" : "|<") .addHover(pageCount > currentPage ? LC.info_nextPageHover.getLocale(): LC.info_firstPageHover.getLocale())
.addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1); .addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1);
if (pageCount != 0) if (pageCount != 0)

View File

@ -32,6 +32,7 @@ import com.gamingmesh.jobs.stuff.TimeManage;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Container.CMIList; import net.Zrips.CMILib.Container.CMIList;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Time.CMITimeManager;
public class Placeholder { public class Placeholder {
@ -448,7 +449,7 @@ public class Placeholder {
case user_doneq: case user_doneq:
return Integer.toString(user.getDoneQuests()); return Integer.toString(user.getDoneQuests());
case user_seen: case user_seen:
return TimeManage.to24hourShort(System.currentTimeMillis() - user.getSeen()); return CMITimeManager.to24hourShort(System.currentTimeMillis() - user.getSeen());
case user_totallevels: case user_totallevels:
return Integer.toString(user.getTotalLevels()); return Integer.toString(user.getTotalLevels());
case user_points: case user_points:
@ -506,7 +507,7 @@ public class Placeholder {
case plimit_$1: case plimit_$1:
return Double.toString(user.getPaymentLimit().getAmount(CurrencyType.getByName(keyValue))); return Double.toString(user.getPaymentLimit().getAmount(CurrencyType.getByName(keyValue)));
case plimit_tleft_$1: 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: case user_jlevel_$1:
return j == null ? "0" : j.getLevelFormatted(); return j == null ? "0" : j.getLevelFormatted();
case user_jexp_$1: case user_jexp_$1:
@ -666,6 +667,6 @@ public class Placeholder {
} }
private static String convert(boolean state) { 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();
} }
} }

View File

@ -25,7 +25,9 @@ import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class JobsCommands implements CommandExecutor { public class JobsCommands implements CommandExecutor {
@ -63,7 +65,7 @@ public class JobsCommands implements CommandExecutor {
try { try {
page = Integer.parseInt(args[1]); page = Integer.parseInt(args[1]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber")); CMIMessages.sendMessage(sender, LC.info_UseInteger);
return true; return true;
} }
return help(sender, page); return help(sender, page);
@ -72,16 +74,16 @@ public class JobsCommands implements CommandExecutor {
String cmd = args[0].toLowerCase(); String cmd = args[0].toLowerCase();
Cmd cmdClass = getCmdClass(cmd); Cmd cmdClass = getCmdClass(cmd);
if (cmdClass == null) { if (cmdClass == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noCommand")); CMIMessages.sendMessage(sender, LC.info_NoCommand);
return true; return true;
} }
if (!hasCommandPermission(sender, cmd)) { if (!hasCommandPermission(sender, cmd)) {
if (sender instanceof Player) { 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); .addHover("&2" + label + ".command." + cmd).show(sender);
} else } else
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); CMIMessages.sendMessage(sender, LC.info_NoPermission);
return true; return true;
} }
@ -120,7 +122,7 @@ public class JobsCommands implements CommandExecutor {
protected boolean help(CommandSender sender, int page) { protected boolean help(CommandSender sender, int page) {
Set<String> commands = getCommands(sender); Set<String> commands = getCommands(sender);
if (commands.isEmpty()) { if (commands.isEmpty()) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); CMIMessages.sendMessage(sender, LC.info_NoPermission);
return true; return true;
} }

View File

@ -14,13 +14,15 @@ import com.gamingmesh.jobs.container.RestrictedArea;
import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.hooks.HookManager;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class area implements Cmd { public class area implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -9,6 +9,8 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Items.CMIMaterial; 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.RawMessages.RawMessage;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
@ -18,7 +20,7 @@ public class blockinfo implements Cmd {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -14,6 +14,8 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.hooks.HookManager;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class bonus implements Cmd { public class bonus implements Cmd {
@ -21,7 +23,7 @@ public class bonus implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -15,6 +15,8 @@ import com.gamingmesh.jobs.container.BlockProtection;
import com.gamingmesh.jobs.container.DBAction; import com.gamingmesh.jobs.container.DBAction;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
public class bp implements Cmd { 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) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }
boolean all = false; boolean all = false;

View File

@ -8,6 +8,9 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes; import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class clearownership implements Cmd { public class clearownership implements Cmd {
@Override @Override
@ -33,7 +36,7 @@ public class clearownership implements Cmd {
if (jPlayer == null) { if (jPlayer == null) {
if (args.length >= 1) if (args.length >= 1)
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); CMIMessages.sendMessage(sender, LC.info_NoInformation);
else else
Jobs.getCommandManager().sendUsage(sender, "clearownership"); Jobs.getCommandManager().sendUsage(sender, "clearownership");
return true; return true;

View File

@ -8,12 +8,15 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType; import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class convert implements Cmd { public class convert implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (sender instanceof Player) { if (sender instanceof Player) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.fromconsole")); CMIMessages.sendMessage(sender, LC.info_FromConsole);
return true; return true;
} }

View File

@ -16,6 +16,8 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.NBT.CMINBT; import net.Zrips.CMILib.NBT.CMINBT;
public class edititembonus implements Cmd { public class edititembonus implements Cmd {
@ -35,7 +37,7 @@ public class edititembonus implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -6,6 +6,9 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.PlayerPoints; import com.gamingmesh.jobs.container.PlayerPoints;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class editpoints implements Cmd { public class editpoints implements Cmd {
@Override @Override
@ -25,7 +28,7 @@ public class editpoints implements Cmd {
try { try {
amount = Double.parseDouble(args[2]); amount = Double.parseDouble(args[2]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber")); CMIMessages.sendMessage(sender, LC.info_UseInteger);
return true; return true;
} }

View File

@ -9,6 +9,9 @@ import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.dao.JobsDAO.DBTables; import com.gamingmesh.jobs.dao.JobsDAO.DBTables;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class fireall implements Cmd { public class fireall implements Cmd {
@Override @Override
@ -20,7 +23,7 @@ public class fireall implements Cmd {
if (args[0].equalsIgnoreCase("all")) { if (args[0].equalsIgnoreCase("all")) {
if (sender instanceof Player) { if (sender instanceof Player) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.fromconsole")); CMIMessages.sendMessage(sender, LC.info_FromConsole);
return true; return true;
} }

View File

@ -12,6 +12,8 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.container.TopList;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Scoreboards.CMIScoreboard; import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
public class gtop implements Cmd { public class gtop implements Cmd {
@ -19,7 +21,7 @@ public class gtop implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -9,13 +9,16 @@ import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class info implements Cmd { public class info implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }
@ -39,7 +42,7 @@ public class info implements Cmd {
} }
if (Jobs.getGCManager().hideJobsInfoWithoutPermission && !Jobs.getCommandManager().hasJobPermission(pSender, job)) { 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; return true;
} }

View File

@ -20,6 +20,8 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Items.CMIMaterial; 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.RawMessages.RawMessage;
public class itembonus implements Cmd { public class itembonus implements Cmd {
@ -27,7 +29,7 @@ public class itembonus implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -10,6 +10,8 @@ import com.gamingmesh.jobs.commands.Cmd;
import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Items.CMIMaterial; 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.RawMessages.RawMessage;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
@ -19,7 +21,7 @@ public class iteminfo implements Cmd {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -9,6 +9,8 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class join implements Cmd { public class join implements Cmd {
@ -16,7 +18,7 @@ public class join implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }
@ -39,7 +41,7 @@ public class join implements Cmd {
if (!Jobs.getCommandManager().hasJobPermission(sender, job)) { if (!Jobs.getCommandManager().hasJobPermission(sender, job)) {
// The player do not have permission to join the 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; return true;
} }

View File

@ -9,6 +9,9 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class leave implements Cmd { public class leave implements Cmd {
@Override @Override
@ -29,7 +32,7 @@ public class leave implements Cmd {
} }
if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + args[0].toLowerCase())) { 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; return true;
} }

View File

@ -11,12 +11,15 @@ import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class leaveall implements Cmd { public class leaveall implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -8,7 +8,10 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.economy.PaymentData; 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 { public class limit implements Cmd {
@ -40,7 +43,7 @@ public class limit implements Cmd {
if (JPlayer == null) { if (JPlayer == null) {
if (args.length >= 1) if (args.length >= 1)
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); CMIMessages.sendMessage(sender, LC.info_NoInformation);
else if (!(sender instanceof Player)) else if (!(sender instanceof Player))
Jobs.getCommandManager().sendUsage(sender, "limit"); Jobs.getCommandManager().sendUsage(sender, "limit");
return true; return true;
@ -57,7 +60,7 @@ public class limit implements Cmd {
if (limit.getLeftTime(type) > 0) { if (limit.getLeftTime(type) > 0) {
String typeName = type.getName().toLowerCase(); 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", sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + typeName + "Limit",
"%current%", (int) (limit.getAmount(type) * 100) / 100D, "%current%", (int) (limit.getAmount(type) * 100) / 100D,
"%total%", JPlayer.getLimit(type))); "%total%", JPlayer.getLimit(type)));

View File

@ -17,12 +17,15 @@ import com.gamingmesh.jobs.container.Log;
import com.gamingmesh.jobs.container.LogAmounts; import com.gamingmesh.jobs.container.LogAmounts;
import com.gamingmesh.jobs.stuff.Sorting; import com.gamingmesh.jobs.stuff.Sorting;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class log implements Cmd { public class log implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player) && args.length != 1) { if (!(sender instanceof Player) && args.length != 1) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -20,6 +20,7 @@ import net.Zrips.CMILib.Container.CMILocation;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Locale.Snd; import net.Zrips.CMILib.Locale.Snd;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class ownedblocks implements Cmd { public class ownedblocks implements Cmd {
@ -36,7 +37,7 @@ public class ownedblocks implements Cmd {
if (jPlayer == null) { if (jPlayer == null) {
if (args.length >= 1) if (args.length >= 1)
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); CMIMessages.sendMessage(sender, LC.info_NoInformation);
else else
Jobs.getCommandManager().sendUsage(sender, "ownedblocks"); Jobs.getCommandManager().sendUsage(sender, "ownedblocks");
return true; return true;

View File

@ -8,6 +8,9 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.PlayerPoints; import com.gamingmesh.jobs.container.PlayerPoints;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class points implements Cmd { public class points implements Cmd {
@Override @Override
@ -30,7 +33,7 @@ public class points implements Cmd {
if (jPlayer == null) { if (jPlayer == null) {
if (args.length >= 1) if (args.length >= 1)
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); CMIMessages.sendMessage(sender, LC.info_NoInformation);
else else
Jobs.getCommandManager().sendUsage(sender, "points"); Jobs.getCommandManager().sendUsage(sender, "points");
return true; return true;

View File

@ -16,7 +16,10 @@ import com.gamingmesh.jobs.container.QuestObjective;
import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.stuff.TimeManage; 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.RawMessages.RawMessage;
import net.Zrips.CMILib.Time.CMITimeManager;
public class quests implements Cmd { public class quests implements Cmd {
@ -35,7 +38,7 @@ public class quests implements Cmd {
if (jPlayer == null) { if (jPlayer == null) {
if (args.length >= 1) if (args.length >= 1)
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); CMIMessages.sendMessage(sender, LC.info_NoInformation);
else else
Jobs.getCommandManager().sendUsage(sender, "quests"); Jobs.getCommandManager().sendUsage(sender, "quests");
return true; return true;
@ -102,7 +105,7 @@ public class quests implements Cmd {
for (String current : hoverMsg.split("\n")) { for (String current : hoverMsg.split("\n")) {
current = current.replace("[jobName]", jobProg.getJob().getName()) 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]")) { if (current.contains("[desc]")) {
hoverList.addAll(quest.getDescription()); hoverList.addAll(quest.getDescription());

View File

@ -5,13 +5,16 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class shop implements Cmd { public class shop implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return true; return true;
} }

View File

@ -9,6 +9,8 @@ import com.gamingmesh.jobs.commands.JobsCommands;
import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage; import net.Zrips.CMILib.RawMessages.RawMessage;
public class stats implements Cmd { public class stats implements Cmd {
@ -26,7 +28,7 @@ public class stats implements Cmd {
if (jPlayer == null) { if (jPlayer == null) {
if (args.length >= 1) if (args.length >= 1)
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); CMIMessages.sendMessage(sender, LC.info_NoInformation);
else else
Jobs.getCommandManager().sendUsage(sender, "stats"); Jobs.getCommandManager().sendUsage(sender, "stats");
return true; return true;

View File

@ -9,12 +9,15 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ToggleBarHandling; import com.gamingmesh.jobs.stuff.ToggleBarHandling;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
public class toggle implements Cmd { public class toggle implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }

View File

@ -13,6 +13,8 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.container.TopList;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Scoreboards.CMIScoreboard; import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
public class top implements Cmd { public class top implements Cmd {
@ -20,7 +22,7 @@ public class top implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); CMIMessages.sendMessage(sender, LC.info_Ingame);
return false; return false;
} }
@ -58,7 +60,7 @@ public class top implements Cmd {
List<TopList> fullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart()); List<TopList> fullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart());
if (fullList.isEmpty()) { if (fullList.isEmpty()) {
player.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); CMIMessages.sendMessage(sender, LC.info_NoInformation);
return true; return true;
} }

View File

@ -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("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.toplineseparator", "&7*********************** &6%playerdisplayname% &7***********************");
c.get("general.info.separator", "&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.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.furnace", "Furnace");
c.get("general.info.blocks.smoker", "Smoker"); c.get("general.info.blocks.smoker", "Smoker");
c.get("general.info.blocks.blastfurnace", "Blast furnace"); 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.error", "&cThere was an error in the command.");
c.get("general.admin.success", "&eYour command has been performed."); 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.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.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.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.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.worldisdisabled", "&cYou can't use command in this world!");
c.get("general.error.newRegistration", "&eRegistered new ownership for [block] &7[current]&e/&f[max]"); 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.noRegistration", "&cYou've reached max [block] count!");
c.get("general.error.blockDisabled", "&6Payments from &e[type] &6got disabled. &2[location]"); 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.cmdUsage", "&2Usage: &7[command]");
c.get("command.help.output.label", "Jobs"); 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.helpPageDescription", "&2* [description]");
c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------"); 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.info", "Boosts money gain for all players");
c.get("command.moneyboost.help.args", "[jobname]/all/reset [time]/[rate]"); 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.working", "&2&nAlready working");
c.get("command.info.gui.cantJoin", "&cYou can't join to the selected job."); 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.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.info", "&eBreak");
c.get("command.info.output.break.none", "%jobname% does not get money for breaking blocks."); c.get("command.info.output.break.none", "%jobname% does not get money for breaking blocks.");

View File

@ -38,6 +38,7 @@ import net.Zrips.CMILib.GUI.CMIGuiButton;
import net.Zrips.CMILib.GUI.GUIManager.GUIClickType; import net.Zrips.CMILib.GUI.GUIManager.GUIClickType;
import net.Zrips.CMILib.GUI.GUIManager.GUIRows; import net.Zrips.CMILib.GUI.GUIManager.GUIRows;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -271,7 +272,7 @@ public class ShopManager {
int prevSlot = getPrevButtonSlot(guiSize.getFields(), page); int prevSlot = getPrevButtonSlot(guiSize.getFields(), page);
if (prevSlot != -1 && page > 1) { if (prevSlot != -1 && page > 1) {
meta.setDisplayName(Jobs.getLanguage().getMessage("command.help.output.prevPage")); meta.setDisplayName(LC.info_prevPage.getLocale());
item.setItemMeta(meta); item.setItemMeta(meta);
gui.addButton(new CMIGuiButton(prevSlot, item) { gui.addButton(new CMIGuiButton(prevSlot, item) {
@ -284,7 +285,7 @@ public class ShopManager {
int nextSlot = getNextButtonSlot(guiSize.getFields(), page); int nextSlot = getNextButtonSlot(guiSize.getFields(), page);
if (nextSlot != -1 && !getItemsByPage(page + 1).isEmpty()) { 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); item.setItemMeta(meta);
gui.addButton(new CMIGuiButton(nextSlot, item) { gui.addButton(new CMIGuiButton(nextSlot, item) {
@Override @Override

View File

@ -25,6 +25,8 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.TimeManage; import com.gamingmesh.jobs.stuff.TimeManage;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Time.CMITimeManager;
public class JobProgression { public class JobProgression {
private Job job; private Job job;
private JobsPlayer jPlayer; private JobsPlayer jPlayer;
@ -264,7 +266,7 @@ public class JobProgression {
} }
public String getRejoinTimeMessage() { 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() { public Double getLastExperience() {

View File

@ -46,6 +46,7 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Equations.Parser; import net.Zrips.CMILib.Equations.Parser;
import net.Zrips.CMILib.Items.CMIMaterial; import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Time.CMITimeManager;
public class JobsPlayer { public class JobsPlayer {
@ -256,7 +257,7 @@ public class JobsPlayer {
} }
if (data.isAnnounceTime(limit.getAnnouncementDelay()) && player.isOnline()) 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)) if (data.isReseted(type))
data.setReseted(type, false); data.setReseted(type, false);

View File

@ -86,6 +86,8 @@ import net.Zrips.CMILib.Colors.CMIChatColor;
import net.Zrips.CMILib.Items.ArmorTypes; import net.Zrips.CMILib.Items.ArmorTypes;
import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Items.CMIMaterial; 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.NBT.CMINBT;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
@ -294,7 +296,7 @@ public class JobsListener implements Listener {
try { try {
number = Integer.parseInt(numberString); number = Integer.parseInt(numberString);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
player.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber")); CMIMessages.sendMessage(player, LC.info_UseInteger);
return; return;
} }

View File

@ -3,8 +3,6 @@ package com.gamingmesh.jobs.stuff;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import com.gamingmesh.jobs.Jobs;
public class TimeManage { public class TimeManage {
public static int timeInInt() { public static int timeInInt() {
@ -16,40 +14,4 @@ public class TimeManage {
calendar.setTimeInMillis(time); calendar.setTimeInMillis(time);
return Integer.valueOf(new SimpleDateFormat("YYMMdd").format(calendar.getTime())); 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;
}
} }