From 5bc33ea05511cac35e82e5aa54b52e452b7a0aac Mon Sep 17 00:00:00 2001 From: William Date: Wed, 19 Jun 2024 12:49:03 +0100 Subject: [PATCH] fix: NPE fetching usage text --- .../main/java/net/william278/uniform/bukkit/BukkitCommand.java | 3 ++- gradle.properties | 2 +- .../java/net/william278/uniform/paper/LegacyPaperCommand.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bukkit/src/main/java/net/william278/uniform/bukkit/BukkitCommand.java b/bukkit/src/main/java/net/william278/uniform/bukkit/BukkitCommand.java index 1e00580..7ebbd0d 100644 --- a/bukkit/src/main/java/net/william278/uniform/bukkit/BukkitCommand.java +++ b/bukkit/src/main/java/net/william278/uniform/bukkit/BukkitCommand.java @@ -32,6 +32,7 @@ import net.william278.uniform.BaseCommand; import net.william278.uniform.Command; import net.william278.uniform.Permission; import net.william278.uniform.Uniform; +import org.bukkit.Bukkit; import org.bukkit.command.CommandException; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; @@ -87,7 +88,7 @@ public class BukkitCommand extends BaseCommand { @NotNull private String getUsageText() { - return dispatcher.getSmartUsage(dispatcher.getRoot(), null).values().stream() + return dispatcher.getSmartUsage(dispatcher.getRoot(), Bukkit.getConsoleSender()).values().stream() .map("/%s"::formatted).collect(Collectors.joining("\n")); } diff --git a/gradle.properties b/gradle.properties index 5f884cb..44c5135 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,6 @@ javaVersion=17 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.daemon=true -library_version=1.1.7 +library_version=1.1.8 library_archive=uniform library_description=Cross-platform wrapper for making Brigadier commands, based on BrigadierWrapper by Tofaa2, itself inspired by emortalmcs command system. \ No newline at end of file diff --git a/paper/src/main/java/net/william278/uniform/paper/LegacyPaperCommand.java b/paper/src/main/java/net/william278/uniform/paper/LegacyPaperCommand.java index 5ce5b3a..2b11994 100644 --- a/paper/src/main/java/net/william278/uniform/paper/LegacyPaperCommand.java +++ b/paper/src/main/java/net/william278/uniform/paper/LegacyPaperCommand.java @@ -27,6 +27,7 @@ import com.mojang.brigadier.suggestion.Suggestion; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.william278.uniform.*; +import org.bukkit.Bukkit; import org.bukkit.command.CommandException; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; @@ -92,7 +93,7 @@ public class LegacyPaperCommand extends BaseCommand { @NotNull private String getUsageText() { - return dispatcher.getSmartUsage(dispatcher.getRoot(), null).values().stream() + return dispatcher.getSmartUsage(dispatcher.getRoot(), Bukkit.getConsoleSender()).values().stream() .map("/%s"::formatted).collect(Collectors.joining("\n")); }