From c2f03d5279a3695fe689ca8cbff049f9b82c966d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 28 Dec 2021 14:40:59 +0100 Subject: [PATCH] Hotfix SWCommand command sorting --- 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 3dd6f8f..5715127 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 af17e75..f4b7e10 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) + subCommand.length; + comparableValue = parameters[parameters.length - 1].isVarArgs() ? Integer.MAX_VALUE : parameters.length; guardChecker = SWCommandUtils.getGuardChecker(parameters[0], localGuardChecker);