From e6b32bace2aae698ef80b624fec3c30bf232119f Mon Sep 17 00:00:00 2001 From: montlikadani Date: Thu, 16 Aug 2018 17:39:26 +0200 Subject: [PATCH] Update JobsCommands.java --- .../jobs/commands/JobsCommands.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java index ef2f79b0..9adc3be2 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java @@ -42,8 +42,8 @@ import com.gamingmesh.jobs.stuff.RawMessage; public class JobsCommands implements CommandExecutor { private static final String label = "jobs"; private static final String packagePath = "com.gamingmesh.jobs.commands.list"; - private static final List hidenCommands = new ArrayList(); - Map CommandList = new HashMap(); + private static final List hidenCommands = new ArrayList<>(); + Map CommandList = new HashMap<>(); protected Jobs plugin; @@ -109,10 +109,6 @@ public class JobsCommands implements CommandExecutor { } } -// if (cmdClass == null) { -// return help(sender, 1); -// } - boolean back = cmdClass.perform(plugin, sender, myArgs); if (back) return true; @@ -184,7 +180,7 @@ public class JobsCommands implements CommandExecutor { } private static List getClassesFromPackage(String pckgname) throws ClassNotFoundException { - List result = new ArrayList(); + List result = new ArrayList<>(); try { for (URL jarURL : ((URLClassLoader) Jobs.class.getClassLoader()).getURLs()) { try { @@ -201,7 +197,7 @@ public class JobsCommands implements CommandExecutor { private static List getClassesInSamePackageFromJar(String packageName, String jarPath) { JarFile jarFile = null; - List listOfCommands = new ArrayList(); + List listOfCommands = new ArrayList<>(); try { jarFile = new JarFile(jarPath); Enumeration en = jarFile.entries(); @@ -228,7 +224,7 @@ public class JobsCommands implements CommandExecutor { } public Map GetCommands(CommandSender sender) { - Map temp = new HashMap(); + Map temp = new HashMap<>(); for (Entry cmd : CommandList.entrySet()) { if (!hasCommandPermission(sender, cmd.getKey())) continue; @@ -239,7 +235,7 @@ public class JobsCommands implements CommandExecutor { public void fillCommands() { List lm = new ArrayList(); - HashMap> classes = new HashMap>(); + HashMap> classes = new HashMap<>(); try { lm = getClassesFromPackage(packagePath); } catch (ClassNotFoundException e) { @@ -289,14 +285,14 @@ public class JobsCommands implements CommandExecutor { } private static Map sort(Map unsortMap) { - List> list = new LinkedList>(unsortMap.entrySet()); + List> list = new LinkedList<>(unsortMap.entrySet()); Collections.sort(list, new Comparator>() { @Override public int compare(Map.Entry o1, Map.Entry o2) { return (o1.getValue()).compareTo(o2.getValue()); } }); - Map sortedMap = new LinkedHashMap(); + Map sortedMap = new LinkedHashMap<>(); for (Iterator> it = list.iterator(); it.hasNext();) { Map.Entry entry = it.next(); sortedMap.put(entry.getKey(), entry.getValue()); @@ -351,7 +347,7 @@ public class JobsCommands implements CommandExecutor { type = type.toLowerCase(); } - List message = new ArrayList(); + List message = new ArrayList<>(); int showAllTypes = 1; for (ActionType actionType : ActionType.values()) {