From ba601dde43b11e18c4a0f15dded5a56d8c07496d Mon Sep 17 00:00:00 2001 From: montlikadani Date: Thu, 14 Jan 2021 22:23:06 +0100 Subject: [PATCH] We don't need anymore to sort commands by int, now it is sorted by alphabetically This will result in a slightly faster display for list of commands --- .../com/gamingmesh/jobs/CMIGUI/CMIGui.java | 2 +- .../gamingmesh/jobs/commands/JobCommand.java | 30 ------- .../jobs/commands/JobsCommands.java | 79 +++++++------------ .../jobs/commands/list/archive.java | 2 - .../gamingmesh/jobs/commands/list/area.java | 2 - .../jobs/commands/list/blockinfo.java | 2 - .../gamingmesh/jobs/commands/list/bonus.java | 2 - .../com/gamingmesh/jobs/commands/list/bp.java | 2 - .../gamingmesh/jobs/commands/list/browse.java | 2 - .../jobs/commands/list/clearownership.java | 2 - .../jobs/commands/list/convert.java | 2 - .../gamingmesh/jobs/commands/list/demote.java | 2 - .../jobs/commands/list/edititembonus.java | 2 - .../jobs/commands/list/editjobs.java | 2 - .../jobs/commands/list/editpoints.java | 2 - .../jobs/commands/list/editquests.java | 2 - .../gamingmesh/jobs/commands/list/employ.java | 2 - .../jobs/commands/list/entitylist.java | 2 - .../gamingmesh/jobs/commands/list/exp.java | 2 - .../jobs/commands/list/expboost.java | 2 - .../jobs/commands/list/explored.java | 9 +-- .../gamingmesh/jobs/commands/list/fire.java | 2 - .../jobs/commands/list/fireall.java | 2 - .../gamingmesh/jobs/commands/list/give.java | 2 - .../gamingmesh/jobs/commands/list/glog.java | 2 - .../jobs/commands/list/grantxp.java | 4 +- .../gamingmesh/jobs/commands/list/gtop.java | 2 - .../gamingmesh/jobs/commands/list/info.java | 2 - .../jobs/commands/list/itembonus.java | 2 - .../jobs/commands/list/iteminfo.java | 2 - .../gamingmesh/jobs/commands/list/join.java | 2 - .../gamingmesh/jobs/commands/list/leave.java | 2 - .../jobs/commands/list/leaveall.java | 2 - .../gamingmesh/jobs/commands/list/level.java | 2 - .../gamingmesh/jobs/commands/list/limit.java | 2 - .../gamingmesh/jobs/commands/list/log.java | 9 +-- .../jobs/commands/list/moneyboost.java | 2 - .../jobs/commands/list/placeholders.java | 2 - .../jobs/commands/list/playerinfo.java | 2 - .../jobs/commands/list/pointboost.java | 2 - .../gamingmesh/jobs/commands/list/points.java | 2 - .../jobs/commands/list/promote.java | 2 - .../gamingmesh/jobs/commands/list/quests.java | 2 - .../gamingmesh/jobs/commands/list/reload.java | 2 - .../jobs/commands/list/removexp.java | 5 +- .../jobs/commands/list/resetlimit.java | 2 - .../jobs/commands/list/resetquest.java | 2 - .../jobs/commands/list/schedule.java | 2 - .../gamingmesh/jobs/commands/list/shop.java | 2 - .../jobs/commands/list/signupdate.java | 2 - .../jobs/commands/list/skipquest.java | 2 - .../gamingmesh/jobs/commands/list/stats.java | 2 - .../gamingmesh/jobs/commands/list/toggle.java | 2 - .../gamingmesh/jobs/commands/list/top.java | 2 - .../jobs/commands/list/transfer.java | 2 - .../jobs/config/GeneralConfigManager.java | 4 - .../jobs/container/CurrencyLimit.java | 2 +- .../com/gamingmesh/jobs/stuff/Sorting.java | 22 ------ .../gamingmesh/jobs/stuff/TabComplete.java | 2 +- 59 files changed, 39 insertions(+), 225 deletions(-) delete mode 100644 src/main/java/com/gamingmesh/jobs/commands/JobCommand.java diff --git a/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java b/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java index fd5c898c..3f65bc05 100644 --- a/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java +++ b/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java @@ -306,7 +306,7 @@ public class CMIGui { } public void addPagination(PageInfo pi, Object cmd, String pagePref) { - addPagination(pi, JobsCommands.label + " " + cmd.getClass().getSimpleName(), pagePref); + addPagination(pi, JobsCommands.LABEL + " " + cmd.getClass().getSimpleName(), pagePref); } public void addPagination(PageInfo pi, String cmd, String pagePref) { diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobCommand.java b/src/main/java/com/gamingmesh/jobs/commands/JobCommand.java deleted file mode 100644 index bb92fa73..00000000 --- a/src/main/java/com/gamingmesh/jobs/commands/JobCommand.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Jobs Plugin for Bukkit - * Copyright (C) 2011 Zak Ford - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.gamingmesh.jobs.commands; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD}) -public @interface JobCommand { - int value(); -} diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java index f6d6f678..872f76e8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java @@ -1,12 +1,10 @@ package com.gamingmesh.jobs.commands; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; +import java.util.TreeSet; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; +import java.util.Set; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -26,16 +24,15 @@ import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.Title; import com.gamingmesh.jobs.stuff.PageInfo; -import com.gamingmesh.jobs.stuff.Sorting; import com.gamingmesh.jobs.stuff.Util; public class JobsCommands implements CommandExecutor { - public static final String label = "jobs"; + public static final String LABEL = "jobs"; - private static final String packagePath = "com.gamingmesh.jobs.commands.list"; + private static final String PACKAGEPATH = "com.gamingmesh.jobs.commands.list"; - private final Map commandList = new HashMap<>(); + private final Set commandList = new TreeSet<>(); protected Jobs plugin; @@ -43,7 +40,7 @@ public class JobsCommands implements CommandExecutor { this.plugin = plugin; } - public Map getCommands() { + public Set getCommands() { return commandList; } @@ -92,22 +89,18 @@ public class JobsCommands implements CommandExecutor { return true; } - boolean back = cmdClass.perform(plugin, sender, myArgs); - if (back) - return true; - - return help(sender, 1); + return cmdClass.perform(plugin, sender, myArgs) || help(sender, 1); } - private static String[] reduceArgs(String[] args) { + private String[] reduceArgs(String[] args) { return args.length <= 1 ? new String[0] : Arrays.copyOfRange(args, 1, args.length); } - private static boolean hasCommandPermission(CommandSender sender, String cmd) { + private boolean hasCommandPermission(CommandSender sender, String cmd) { return sender.hasPermission("jobs.command." + cmd); } - private static String getUsage(String cmd) { + private String getUsage(String cmd) { String cmdString = Jobs.getLanguage().getMessage("command.help.output.cmdFormat", "[command]", Jobs.getLanguage().getMessage("command.help.output.label") + " " + cmd); String key = "command." + cmd + ".help.args"; if (Jobs.getLanguage().containsKey(key) && !Jobs.getLanguage().getMessage(key).isEmpty()) { @@ -126,14 +119,12 @@ public class JobsCommands implements CommandExecutor { } protected boolean help(CommandSender sender, int page) { - Map commands = getCommands(sender); + Set commands = getCommands(sender); if (commands.isEmpty()) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission")); return true; } - commands = Sorting.sortASC(commands); - PageInfo pi = new PageInfo(7, commands.size(), page); if (page > pi.getTotalPages() || page < 1) { ActionBarManager.send(sender, Jobs.getLanguage().getMessage("general.error.noHelpPage")); @@ -141,70 +132,58 @@ public class JobsCommands implements CommandExecutor { } sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title")); - for (String one : commands.keySet()) { + for (String one : commands) { if (!pi.isEntryOk()) continue; if (pi.isBreak()) break; - String msg = Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one - + ".help.info")); - sender.sendMessage(msg); + sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one + + ".help.info"))); } - plugin.showPagination(sender, pi, label + " ?"); + plugin.showPagination(sender, pi, LABEL + " ?"); return true; } - public Map getCommands(CommandSender sender) { - Map temp = new HashMap<>(); - for (Entry cmd : commandList.entrySet()) { - if (sender instanceof Player && !hasCommandPermission(sender, cmd.getKey())) + public Set getCommands(CommandSender sender) { + Set temp = new TreeSet<>(); + for (String cmd : commandList) { + if (sender instanceof Player && !hasCommandPermission(sender, cmd)) continue; - temp.put(cmd.getKey(), cmd.getValue()); + temp.add(cmd); } + return temp; } public void fillCommands() { List lm = new ArrayList<>(); - HashMap> classes = new HashMap<>(); try { - lm = Util.getFilesFromPackage(packagePath); + lm = Util.getFilesFromPackage(PACKAGEPATH); } catch (ClassNotFoundException e) { e.printStackTrace(); } for (String one : lm) { - Class newclass = getClass(one); - if (newclass != null) - classes.put(one, newclass); + Class newClass = getClass(one); + if (newClass != null) + commandList.add(newClass.getSimpleName()); } - - for (Entry> oneClass : classes.entrySet()) { - for (Method met : oneClass.getValue().getMethods()) { - if (!met.isAnnotationPresent(JobCommand.class)) - continue; - - commandList.put(oneClass.getKey(), met.getAnnotation(JobCommand.class).value()); - break; - } - } - } - private static Class getClass(String cmd) { + private Class getClass(String cmd) { try { - return Class.forName(packagePath + "." + cmd.toLowerCase()); + return Class.forName(PACKAGEPATH + "." + cmd.toLowerCase()); } catch (ClassNotFoundException e) { } return null; } - private static Cmd getCmdClass(String cmd) { + private Cmd getCmdClass(String cmd) { try { - Class nmsClass = Class.forName(packagePath + "." + cmd.toLowerCase()); + Class nmsClass = Class.forName(PACKAGEPATH + "." + cmd.toLowerCase()); if (Cmd.class.isAssignableFrom(nmsClass)) { return (Cmd) nmsClass.getConstructor().newInstance(); } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java index 61606634..3d3925e2 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java @@ -9,14 +9,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; public class archive implements Cmd { @Override - @JobCommand(1401) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { JobsPlayer jPlayer = null; if (args.length >= 1) { 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 ef5217a0..3ec7ba3a 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/area.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/area.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.config.RestrictedAreaManager; import com.gamingmesh.jobs.container.CuboidArea; import com.gamingmesh.jobs.container.RestrictedArea; @@ -19,7 +18,6 @@ import com.gamingmesh.jobs.hooks.HookManager; public class area implements Cmd { @Override - @JobCommand(308) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 bf1510c9..f782fc0d 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java @@ -7,14 +7,12 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.stuff.Util; public class blockinfo implements Cmd { @Override @SuppressWarnings("deprecation") - @JobCommand(1472) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 ae842e2b..a26daa7b 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java @@ -7,7 +7,6 @@ import com.gamingmesh.jobs.PlayerManager.BoostOf; import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Boost; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; @@ -17,7 +16,6 @@ import com.gamingmesh.jobs.hooks.HookManager; public class bonus implements Cmd { @Override - @JobCommand(300) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 84dacaee..eb4a13d8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/bp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/bp.java @@ -13,7 +13,6 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.BlockProtection; import com.gamingmesh.jobs.container.DBAction; @@ -21,7 +20,6 @@ public class bp implements Cmd { @SuppressWarnings("deprecation") @Override - @JobCommand(1900) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java index acf95ad2..f264fe47 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java @@ -10,14 +10,12 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.stuff.PageInfo; public class browse implements Cmd { @Override - @JobCommand(200) public boolean perform(Jobs plugin, CommandSender sender, final String[] args) { if (Jobs.getGCManager().BrowseUseNewLook) { List jobList = new ArrayList<>(Jobs.getJobs()); 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 386be5b4..6bd72f88 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/clearownership.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/clearownership.java @@ -6,7 +6,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip; import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes; @@ -14,7 +13,6 @@ import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes; public class clearownership implements Cmd { @Override - @JobCommand(400) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { JobsPlayer jPlayer = null; if (args.length >= 1) { 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 9e689234..943fd910 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/convert.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/convert.java @@ -7,13 +7,11 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.dao.JobsManager.DataBaseType; public class convert implements Cmd { @Override - @JobCommand(2600) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (sender instanceof Player) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.fromconsole")); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/demote.java b/src/main/java/com/gamingmesh/jobs/commands/list/demote.java index a702fcb1..988796c8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/demote.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/demote.java @@ -7,14 +7,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class demote implements Cmd { @Override - @JobCommand(1700) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (args.length < 3) { Jobs.getCommandManager().sendUsage(sender, "demote"); 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 824a326c..92da0081 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java @@ -10,7 +10,6 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.CMIReflections; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; @@ -31,7 +30,6 @@ public class edititembonus implements Cmd { } @Override - @JobCommand(743) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java b/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java index 8aa4b646..83d77625 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java @@ -5,7 +5,6 @@ import com.gamingmesh.jobs.CMILib.ItemReflection; import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.config.ConfigManager.KeyValues; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.CurrencyType; @@ -24,7 +23,6 @@ public class editjobs implements Cmd { @SuppressWarnings("deprecation") @Override - @JobCommand(475) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (!(sender instanceof Player)) 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 470c17c5..39b6ea83 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java @@ -3,14 +3,12 @@ package com.gamingmesh.jobs.commands.list; import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.PlayerPoints; public class editpoints implements Cmd { @Override - @JobCommand(477) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (args.length != 3) { Jobs.getCommandManager().sendUsage(sender, "editpoints"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java index 2ffd9a56..5ed360c7 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java @@ -20,7 +20,6 @@ import com.gamingmesh.jobs.CMILib.ItemReflection; import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobInfo; @@ -33,7 +32,6 @@ public class editquests implements Cmd { @SuppressWarnings("deprecation") @Override - @JobCommand(721) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (!(sender instanceof Player)) return false; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/employ.java b/src/main/java/com/gamingmesh/jobs/commands/list/employ.java index 25484ca3..3d137f02 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/employ.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/employ.java @@ -5,14 +5,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class employ implements Cmd { @Override - @JobCommand(1800) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (args.length < 2) { Jobs.getCommandManager().sendUsage(sender, "employ"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/entitylist.java b/src/main/java/com/gamingmesh/jobs/commands/list/entitylist.java index a4df10d3..49e6848a 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/entitylist.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/entitylist.java @@ -5,12 +5,10 @@ import org.bukkit.entity.EntityType; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; public class entitylist implements Cmd { @Override - @JobCommand(1452) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length != 0) { Jobs.getCommandManager().sendUsage(sender, "entitylist"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java index ab2a8e0d..a47cefbe 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; @@ -17,7 +16,6 @@ public class exp implements Cmd { } @Override - @JobCommand(1600) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (args.length < 4) { Jobs.getCommandManager().sendUsage(sender, "exp"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/expboost.java b/src/main/java/com/gamingmesh/jobs/commands/list/expboost.java index edd0f1b4..83947f1e 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/expboost.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/expboost.java @@ -4,14 +4,12 @@ import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; public class expboost implements Cmd { @Override - @JobCommand(2300) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (args.length > 3 || args.length <= 1) { Jobs.getCommandManager().sendUsage(sender, "expboost"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/explored.java b/src/main/java/com/gamingmesh/jobs/commands/list/explored.java index bfd277b3..15defcca 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/explored.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/explored.java @@ -2,13 +2,11 @@ package com.gamingmesh.jobs.commands.list; import java.util.HashMap; -import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.ExploreChunk; import com.gamingmesh.jobs.container.ExploreRegion; import com.gamingmesh.jobs.container.PlayerInfo; @@ -16,7 +14,6 @@ import com.gamingmesh.jobs.container.PlayerInfo; public class explored implements Cmd { @Override - @JobCommand(1600) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (!(sender instanceof Player)) @@ -24,16 +21,14 @@ public class explored implements Cmd { Player player = (Player) sender; - World world = player.getWorld(); - HashMap worlds = Jobs.getExplore().getWorlds(); - if (!worlds.containsKey(world.getName())) { + if (!worlds.containsKey(player.getWorld().getName())) { sender.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore")); return true; } - ExploreRegion regions = worlds.get(world.getName()); + ExploreRegion regions = worlds.get(player.getWorld().getName()); ExploreChunk chunk = regions.getChunk(player.getLocation().getChunk()); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/fire.java b/src/main/java/com/gamingmesh/jobs/commands/list/fire.java index 0f7e08d1..49740dd8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/fire.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/fire.java @@ -5,14 +5,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class fire implements Cmd { @Override - @JobCommand(1900) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length < 2) { Jobs.getCommandManager().sendUsage(sender, "fire"); 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 92dc8d32..b37c2d28 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/fireall.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/fireall.java @@ -7,7 +7,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.dao.JobsDAO.DBTables; @@ -15,7 +14,6 @@ import com.gamingmesh.jobs.dao.JobsDAO.DBTables; public class fireall implements Cmd { @Override - @JobCommand(2000) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length < 1) { Jobs.getCommandManager().sendUsage(sender, "fireall"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/give.java b/src/main/java/com/gamingmesh/jobs/commands/list/give.java index 6ca43741..8b794fd0 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/give.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/give.java @@ -7,7 +7,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.ItemBoostManager; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobItems; import com.gamingmesh.jobs.container.JobLimitedItems; @@ -27,7 +26,6 @@ public class give implements Cmd { } @Override - @JobCommand(2500) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { Player player = null; Job job = null; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/glog.java b/src/main/java/com/gamingmesh/jobs/commands/list/glog.java index 45114ab7..9e6440d1 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/glog.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/glog.java @@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.Log; @@ -22,7 +21,6 @@ import com.gamingmesh.jobs.stuff.TimeManage; public class glog implements Cmd { @Override - @JobCommand(1200) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length != 0) { Jobs.getCommandManager().sendUsage(sender, "glog"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/grantxp.java b/src/main/java/com/gamingmesh/jobs/commands/list/grantxp.java index 3f400475..7b5a3c22 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/grantxp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/grantxp.java @@ -6,14 +6,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class grantxp implements Cmd { @Override - @JobCommand(2100) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { Jobs.getCommandManager().sendUsage(sender, "grantxp"); @@ -34,7 +32,7 @@ public class grantxp implements Cmd { double xpGained; try { xpGained = Double.parseDouble(args[2]); - } catch (Throwable e) { + } catch (NumberFormatException e) { sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); 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 b70e440d..770f5d96 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java @@ -9,14 +9,12 @@ import org.bukkit.scoreboard.DisplaySlot; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.stuff.PageInfo; public class gtop implements Cmd { @Override - @JobCommand(601) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 a1960b1e..2f0fcc6c 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/info.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/info.java @@ -5,14 +5,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class info implements Cmd { @Override - @JobCommand(287) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 0fab2258..48049837 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java @@ -10,7 +10,6 @@ import org.bukkit.inventory.ItemStack; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; @@ -23,7 +22,6 @@ import com.gamingmesh.jobs.CMILib.RawMessage; public class itembonus implements Cmd { @Override - @JobCommand(125) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 f52e0456..a6b0aaec 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java @@ -8,13 +8,11 @@ import org.bukkit.inventory.ItemStack; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; public class iteminfo implements Cmd { @Override @SuppressWarnings("deprecation") - @JobCommand(1450) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 bb5881c2..f9681f55 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/join.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/join.java @@ -6,7 +6,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; @@ -15,7 +14,6 @@ import com.gamingmesh.jobs.CMILib.RawMessage; public class join implements Cmd { @Override - @JobCommand(100) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 0ae2f5b8..b0f9b667 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/leave.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/leave.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.Util; @@ -13,7 +12,6 @@ import com.gamingmesh.jobs.stuff.Util; public class leave implements Cmd { @Override - @JobCommand(800) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) return false; 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 6dd7a09d..eb1c91f6 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java @@ -7,7 +7,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.Util; @@ -15,7 +14,6 @@ import com.gamingmesh.jobs.stuff.Util; public class leaveall implements Cmd { @Override - @JobCommand(900) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/level.java b/src/main/java/com/gamingmesh/jobs/commands/list/level.java index 1fe5421b..643590ea 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/level.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/level.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; @@ -17,7 +16,6 @@ public class level implements Cmd { } @Override - @JobCommand(1290) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (args.length < 4) { Jobs.getCommandManager().sendUsage(sender, "level"); 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 976e34fc..369b16a6 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/limit.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/limit.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.economy.PaymentData; @@ -14,7 +13,6 @@ import com.gamingmesh.jobs.stuff.TimeManage; public class limit implements Cmd { @Override - @JobCommand(700) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length != 0 && args.length != 1) { Jobs.getCommandManager().sendUsage(sender, "limit"); 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 4632103e..23fc484f 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/log.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/log.java @@ -11,7 +11,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.Log; @@ -21,7 +20,6 @@ import com.gamingmesh.jobs.stuff.Sorting; public class log implements Cmd { @Override - @JobCommand(1100) 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")); @@ -76,9 +74,8 @@ public class log implements Cmd { sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getName())); for (Log one : logList.values()) { HashMap AmountList = one.getAmountList(); - double totalMoney = 0, - totalExp = 0, - totalPoints = 0; + double totalMoney = 0, totalExp = 0, totalPoints = 0; + for (String oneSorted : unsortMap.keySet()) { for (Entry oneMap : AmountList.entrySet()) { if (oneMap.getKey().equalsIgnoreCase(oneSorted)) { @@ -110,7 +107,7 @@ public class log implements Cmd { sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.ls", "%number%", count, "%action%", one.getActionType(), - "%item%", amounts.getItemName().replace(":0", "").replace("_", " ").toLowerCase(), + "%item%", amounts.getItemName().replace(":0", "").replace('_', ' ').toLowerCase(), "%qty%", amounts.getCount(), "%money%", moneyS, "%exp%", expS, diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/moneyboost.java b/src/main/java/com/gamingmesh/jobs/commands/list/moneyboost.java index a1003e47..ecafc125 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/moneyboost.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/moneyboost.java @@ -4,14 +4,12 @@ import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; public class moneyboost implements Cmd { @Override - @JobCommand(2320) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (args.length > 3 || args.length <= 1) { Jobs.getCommandManager().sendUsage(sender, "moneyboost"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/placeholders.java b/src/main/java/com/gamingmesh/jobs/commands/list/placeholders.java index 6fb7afd5..5c0530f1 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/placeholders.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/placeholders.java @@ -9,13 +9,11 @@ import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceHolders; import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceholderType; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.stuff.PageInfo; public class placeholders implements Cmd { @Override - @JobCommand(1400) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { Player player = null; if (sender instanceof Player) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/playerinfo.java b/src/main/java/com/gamingmesh/jobs/commands/list/playerinfo.java index e05b4060..a4e98c9d 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/playerinfo.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/playerinfo.java @@ -4,14 +4,12 @@ import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class playerinfo implements Cmd { @Override - @JobCommand(1300) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length < 2) { Jobs.getCommandManager().sendUsage(sender, "playerinfo"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/pointboost.java b/src/main/java/com/gamingmesh/jobs/commands/list/pointboost.java index 5ec19fa4..f9bb66e9 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/pointboost.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/pointboost.java @@ -4,14 +4,12 @@ import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; public class pointboost implements Cmd { @Override - @JobCommand(2303) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { if (args.length > 3 || args.length <= 1) { Jobs.getCommandManager().sendUsage(sender, "pointboost"); 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 9ed46370..8b727f2a 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/points.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/points.java @@ -5,14 +5,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.PlayerPoints; public class points implements Cmd { @Override - @JobCommand(450) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length != 0 && args.length != 1) { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/promote.java b/src/main/java/com/gamingmesh/jobs/commands/list/promote.java index 4a4907eb..17965a1b 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/promote.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/promote.java @@ -5,14 +5,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class promote implements Cmd { @Override - @JobCommand(1603) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { Jobs.getCommandManager().sendUsage(sender, "promote"); 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 d3ca38c8..03f70e45 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.QuestObjective; @@ -21,7 +20,6 @@ import com.gamingmesh.jobs.CMILib.RawMessage; public class quests implements Cmd { @Override - @JobCommand(400) public boolean perform(Jobs plugin, final CommandSender sender, String[] args) { JobsPlayer jPlayer = null; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/reload.java b/src/main/java/com/gamingmesh/jobs/commands/list/reload.java index 1ad0632a..bc20c934 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/reload.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/reload.java @@ -4,12 +4,10 @@ import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; public class reload implements Cmd { @Override - @JobCommand(2900) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { Jobs.reload(); sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/removexp.java b/src/main/java/com/gamingmesh/jobs/commands/list/removexp.java index 315ff04f..00e54288 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/removexp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/removexp.java @@ -1,4 +1,3 @@ - package com.gamingmesh.jobs.commands.list; import org.bukkit.command.CommandSender; @@ -6,14 +5,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class removexp implements Cmd { @Override - @JobCommand(2200) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { Jobs.getCommandManager().sendUsage(sender, "removexp"); @@ -35,7 +32,7 @@ public class removexp implements Cmd { double xpLost = 0D; try { xpLost = Double.parseDouble(args[2]); - } catch (Throwable e) { + } catch (NumberFormatException e) { sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java index 597edd40..323a0a98 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java @@ -3,13 +3,11 @@ package com.gamingmesh.jobs.commands.list; import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobsPlayer; public class resetlimit implements Cmd { @Override - @JobCommand(707) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length != 1) { Jobs.getCommandManager().sendUsage(sender, "resetlimit"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java index a3a1bd22..a27e6a4e 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java @@ -7,7 +7,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.QuestProgression; @@ -15,7 +14,6 @@ import com.gamingmesh.jobs.container.QuestProgression; public class resetquest implements Cmd { @Override - @JobCommand(709) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length != 0 && args.length != 1 && args.length != 2) { Jobs.getCommandManager().sendUsage(sender, "resetquest"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/schedule.java b/src/main/java/com/gamingmesh/jobs/commands/list/schedule.java index 1057c010..10d5daf8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/schedule.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/schedule.java @@ -9,12 +9,10 @@ import org.bukkit.configuration.file.FileConfiguration; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; public class schedule implements Cmd { @Override - @JobCommand(1411) public boolean perform(final Jobs plugin, final CommandSender sender, final String[] args) { if (args.length < 2) { Jobs.getCommandManager().sendUsage(sender, "schedule"); 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 cc693f03..7771d5d8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/shop.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/shop.java @@ -4,12 +4,10 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; public class shop implements Cmd { @Override - @JobCommand(750) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/signupdate.java b/src/main/java/com/gamingmesh/jobs/commands/list/signupdate.java index d09484e1..ade00cea 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/signupdate.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/signupdate.java @@ -5,13 +5,11 @@ import org.bukkit.command.CommandSender; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Signs.SignTopType; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; public class signupdate implements Cmd { @Override - @JobCommand(2700) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!Jobs.getGCManager().SignsEnabled) return true; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java b/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java index 7280ac1d..4f35d6d6 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.Quest; @@ -18,7 +17,6 @@ import com.gamingmesh.jobs.economy.BufferedEconomy; public class skipquest implements Cmd { @Override - @JobCommand(709) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length != 2 && args.length != 3) { Jobs.getCommandManager().sendUsage(sender, "skipquest"); 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 d916854a..a7ff397d 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java @@ -6,14 +6,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; public class stats implements Cmd { @Override - @JobCommand(401) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { JobsPlayer jPlayer = null; if (args.length >= 1) { 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 c1cea4ab..89f98bc0 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/toggle.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/toggle.java @@ -6,14 +6,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.ToggleBarHandling; public class toggle implements Cmd { @Override - @JobCommand(1000) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); 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 445da694..6d0aa98f 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/top.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/top.java @@ -9,7 +9,6 @@ import org.bukkit.scoreboard.DisplaySlot; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.stuff.PageInfo; @@ -17,7 +16,6 @@ import com.gamingmesh.jobs.stuff.PageInfo; public class top implements Cmd { @Override - @JobCommand(526) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame")); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/transfer.java b/src/main/java/com/gamingmesh/jobs/commands/list/transfer.java index 3223187b..e103e27f 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/transfer.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/transfer.java @@ -5,14 +5,12 @@ import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; public class transfer implements Cmd { @Override - @JobCommand(1500) public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { if (args.length < 3) { Jobs.getCommandManager().sendUsage(sender, "transfer"); diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index cdc38e48..997a973f 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -389,9 +389,6 @@ public class GeneralConfigManager { "By setting this to true when there is max amount of players explored a chunk then it will be marked as fully explored and exact players who explored it will not be saved to save some memory"); ExploreCompact = c.get("Optimizations.Explore.Compact", true); -// c.addComment("Optimizations.Purge.Use", "By setting this to true, Jobs plugin will clean data base on startup from all jobs with level 1 and at 0 exp"); -// PurgeUse = c.get("Optimizations.Purge.Use", false); - c.addComment("Logging.Use", "With this set to true all players jobs actions will be logged to database for easy to see statistics", "This is still in development and in future it will expand"); LoggingUse = c.get("Logging.Use", false); @@ -573,7 +570,6 @@ public class GeneralConfigManager { String maxExpEquationInput = c.get("Economy.DynamicPayment.equation", "totalworkers / totaljobs / jobstotalplayers - 1"); try { DynamicPaymentEquation = new Parser(maxExpEquationInput); - // test equation DynamicPaymentEquation.setVariable("totalworkers", 100); DynamicPaymentEquation.setVariable("totaljobs", 10); DynamicPaymentEquation.setVariable("jobstotalplayers", 10); diff --git a/src/main/java/com/gamingmesh/jobs/container/CurrencyLimit.java b/src/main/java/com/gamingmesh/jobs/container/CurrencyLimit.java index be3d02ac..2a6b081e 100644 --- a/src/main/java/com/gamingmesh/jobs/container/CurrencyLimit.java +++ b/src/main/java/com/gamingmesh/jobs/container/CurrencyLimit.java @@ -15,7 +15,7 @@ public class CurrencyLimit { public CurrencyLimit(boolean enabled, List stopWith, int timeLimit, int announcementDelay, Parser maxEquation) { this.enabled = enabled; - this.stopWith = stopWith == null ? new ArrayList<>() : stopWith; + setStopWith(stopWith); this.timeLimit = timeLimit; this.announcementDelay = announcementDelay; diff --git a/src/main/java/com/gamingmesh/jobs/stuff/Sorting.java b/src/main/java/com/gamingmesh/jobs/stuff/Sorting.java index ce90ffde..cea5046d 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/Sorting.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/Sorting.java @@ -76,26 +76,4 @@ public class Sorting { } return sortedMap; } - - public static Map sortASC(Map unsortMap) { - - // Convert Map to List - List> list = new LinkedList<>(unsortMap.entrySet()); - - // Sort list with comparator, to compare the Map values - Collections.sort(list, new Comparator>() { - @Override - public int compare(Map.Entry o1, Map.Entry o2) { - return (o1.getValue()).compareTo(o2.getValue()); - } - }); - - // Convert sorted map back to a Map - Map sortedMap = new LinkedHashMap<>(); - for (Iterator> it = list.iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - sortedMap.put(entry.getKey(), entry.getValue()); - } - return sortedMap; - } } diff --git a/src/main/java/com/gamingmesh/jobs/stuff/TabComplete.java b/src/main/java/com/gamingmesh/jobs/stuff/TabComplete.java index f96f2963..52237bfb 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/TabComplete.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/TabComplete.java @@ -32,7 +32,7 @@ public class TabComplete implements TabCompleter { String PartOfCommand = args[0]; List temp = new ArrayList<>(); - Jobs.getCommandManager().getCommands(sender).keySet().forEach(temp::add); + Jobs.getCommandManager().getCommands(sender).forEach(temp::add); StringUtil.copyPartialMatches(PartOfCommand, temp, completionList); } if (args.length > 1)