From 2a2dbd9458f61987cfbd304051f96d7066c8d6cd Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 10 May 2022 09:26:01 +0200 Subject: [PATCH] Update some stuff --- src/de/steamwar/command/AbstractSWCommand.java | 2 +- src/de/steamwar/command/SubCommand.java | 14 +------------- steamwarci.yml | 2 ++ testsrc/de/steamwar/command/ArgumentCommand.java | 2 +- .../de/steamwar/command/ArgumentCommandTest.java | 2 +- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/de/steamwar/command/AbstractSWCommand.java b/src/de/steamwar/command/AbstractSWCommand.java index 1cb830a..fd371df 100644 --- a/src/de/steamwar/command/AbstractSWCommand.java +++ b/src/de/steamwar/command/AbstractSWCommand.java @@ -170,7 +170,7 @@ public abstract class AbstractSWCommand { if (compare != 0) { return compare; } else { - return Double.compare(o1.comparableValue, o2.comparableValue); + return Integer.compare(o1.comparableValue, o2.comparableValue); } }); commandHelpList.sort((o1, o2) -> { diff --git a/src/de/steamwar/command/SubCommand.java b/src/de/steamwar/command/SubCommand.java index c928268..603e6d3 100644 --- a/src/de/steamwar/command/SubCommand.java +++ b/src/de/steamwar/command/SubCommand.java @@ -23,7 +23,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Parameter; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -31,14 +30,6 @@ import java.util.function.Predicate; public class SubCommand { - private static Map, Double> increment = new HashMap<>(); - static { - increment.put(double.class, 0.1); - increment.put(Double.class, 0.1); - increment.put(float.class, 0.1); - increment.put(Float.class, 0.1); - } - private AbstractSWCommand abstractSWCommand; Method method; String[] description; @@ -47,7 +38,7 @@ public class SubCommand { private Function senderFunction; AbstractGuardChecker guardChecker; boolean noTabComplete; - double comparableValue; + int comparableValue; private CommandPart commandPart; @@ -60,9 +51,6 @@ public class SubCommand { Parameter[] parameters = method.getParameters(); comparableValue = parameters[parameters.length - 1].isVarArgs() ? Integer.MAX_VALUE : -parameters.length; - for (Parameter parameter : parameters) { - comparableValue += increment.getOrDefault(parameter.getType(), 0.0); - } guardChecker = SWCommandUtils.getGuardChecker(parameters[0], localGuardChecker); diff --git a/steamwarci.yml b/steamwarci.yml index 73f8039..08bed06 100644 --- a/steamwarci.yml +++ b/steamwarci.yml @@ -3,3 +3,5 @@ build: - "cp ~/gradle.properties ." - "chmod u+x build.gradle" - "./gradlew buildProject" + +artifacts: diff --git a/testsrc/de/steamwar/command/ArgumentCommand.java b/testsrc/de/steamwar/command/ArgumentCommand.java index b4ce500..a107270 100644 --- a/testsrc/de/steamwar/command/ArgumentCommand.java +++ b/testsrc/de/steamwar/command/ArgumentCommand.java @@ -39,7 +39,7 @@ public class ArgumentCommand extends TestSWCommand { } @Register - public void argument(String sender, double d, double d2) { + public void argument(String sender, double d, double d2, double d3, double d4) { throw new ExecutionIdentifier("RunArgument with Double"); } diff --git a/testsrc/de/steamwar/command/ArgumentCommandTest.java b/testsrc/de/steamwar/command/ArgumentCommandTest.java index c546127..e57edd0 100644 --- a/testsrc/de/steamwar/command/ArgumentCommandTest.java +++ b/testsrc/de/steamwar/command/ArgumentCommandTest.java @@ -63,7 +63,7 @@ public class ArgumentCommandTest { public void testDouble() { ArgumentCommand cmd = new ArgumentCommand(); try { - cmd.execute("test", "", new String[]{"0.0", "0.0"}); + cmd.execute("test", "", new String[]{"0.0", "0.0", "0.0", "0.0"}); } catch (Exception e) { assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Double"); }