mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
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
This commit is contained in:
parent
e4896c8ad0
commit
ba601dde43
@ -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) {
|
||||
|
@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Jobs Plugin for Bukkit
|
||||
* Copyright (C) 2011 Zak Ford <zak.j.ford@gmail.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
@ -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<String, Integer> commandList = new HashMap<>();
|
||||
private final Set<String> commandList = new TreeSet<>();
|
||||
|
||||
protected Jobs plugin;
|
||||
|
||||
@ -43,7 +40,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getCommands() {
|
||||
public Set<String> 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<String, Integer> commands = getCommands(sender);
|
||||
Set<String> 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<String, Integer> getCommands(CommandSender sender) {
|
||||
Map<String, Integer> temp = new HashMap<>();
|
||||
for (Entry<String, Integer> cmd : commandList.entrySet()) {
|
||||
if (sender instanceof Player && !hasCommandPermission(sender, cmd.getKey()))
|
||||
public Set<String> getCommands(CommandSender sender) {
|
||||
Set<String> 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<String> lm = new ArrayList<>();
|
||||
HashMap<String, Class<?>> 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<String, Class<?>> 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();
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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"));
|
||||
|
@ -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"));
|
||||
|
@ -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"));
|
||||
|
@ -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)) {
|
||||
|
@ -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<Job> jobList = new ArrayList<>(Jobs.getJobs());
|
||||
|
@ -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) {
|
||||
|
@ -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"));
|
||||
|
@ -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");
|
||||
|
@ -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"));
|
||||
|
@ -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))
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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<String, ExploreRegion> 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());
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"));
|
||||
|
@ -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"));
|
||||
|
@ -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"));
|
||||
|
@ -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"));
|
||||
|
@ -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"));
|
||||
|
@ -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;
|
||||
|
@ -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"));
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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<String, LogAmounts> AmountList = one.getAmountList();
|
||||
double totalMoney = 0,
|
||||
totalExp = 0,
|
||||
totalPoints = 0;
|
||||
double totalMoney = 0, totalExp = 0, totalPoints = 0;
|
||||
|
||||
for (String oneSorted : unsortMap.keySet()) {
|
||||
for (Entry<String, LogAmounts> 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,
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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) {
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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) {
|
||||
|
@ -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"));
|
||||
|
@ -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"));
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -15,7 +15,7 @@ public class CurrencyLimit {
|
||||
|
||||
public CurrencyLimit(boolean enabled, List<CurrencyType> 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;
|
||||
|
||||
|
@ -76,26 +76,4 @@ public class Sorting {
|
||||
}
|
||||
return sortedMap;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> sortASC(Map<String, Integer> unsortMap) {
|
||||
|
||||
// Convert Map to List
|
||||
List<Map.Entry<String, Integer>> list = new LinkedList<>(unsortMap.entrySet());
|
||||
|
||||
// Sort list with comparator, to compare the Map values
|
||||
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
|
||||
@Override
|
||||
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
|
||||
return (o1.getValue()).compareTo(o2.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
// Convert sorted map back to a Map
|
||||
Map<String, Integer> sortedMap = new LinkedHashMap<>();
|
||||
for (Iterator<Map.Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
|
||||
Map.Entry<String, Integer> entry = it.next();
|
||||
sortedMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return sortedMap;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class TabComplete implements TabCompleter {
|
||||
String PartOfCommand = args[0];
|
||||
List<String> 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)
|
||||
|
Loading…
Reference in New Issue
Block a user