From 611bc585760a0e3a27cfd3c6fbd723e65139c1dc Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 13 Dec 2021 01:18:13 +0100 Subject: [PATCH] Fix SubCommand --- SpigotCore_Main/src/de/steamwar/command/SWCommand.java | 2 +- SpigotCore_Main/src/de/steamwar/command/SubCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index 98d742a..a87dfd7 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -174,7 +174,7 @@ public abstract class SWCommand { if (compare != 0) { return compare; } else { - return Integer.compare(o1.comparableValue, o2.comparableValue); + return Integer.compare(-o1.comparableValue, -o2.comparableValue); } }); commandHelpList.sort((o1, o2) -> { diff --git a/SpigotCore_Main/src/de/steamwar/command/SubCommand.java b/SpigotCore_Main/src/de/steamwar/command/SubCommand.java index f4b7e10..af17e75 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SubCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SubCommand.java @@ -52,7 +52,7 @@ class SubCommand { this.subCommand = subCommand; Parameter[] parameters = method.getParameters(); - comparableValue = parameters[parameters.length - 1].isVarArgs() ? Integer.MAX_VALUE : parameters.length; + comparableValue = (parameters[parameters.length - 1].isVarArgs() ? Integer.MAX_VALUE : parameters.length) + subCommand.length; guardChecker = SWCommandUtils.getGuardChecker(parameters[0], localGuardChecker);