fix: NPE fetching usage text

dependabot/gradle/org.projectlombok-lombok-1.18.34 1.1.8
William 5 months ago
parent 6fc0a618ff
commit 5bc33ea055
No known key found for this signature in database

@ -32,6 +32,7 @@ import net.william278.uniform.BaseCommand;
import net.william278.uniform.Command; import net.william278.uniform.Command;
import net.william278.uniform.Permission; import net.william278.uniform.Permission;
import net.william278.uniform.Uniform; import net.william278.uniform.Uniform;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -87,7 +88,7 @@ public class BukkitCommand extends BaseCommand<CommandSender> {
@NotNull @NotNull
private String getUsageText() { 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")); .map("/%s"::formatted).collect(Collectors.joining("\n"));
} }

@ -3,6 +3,6 @@ javaVersion=17
org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.daemon=true org.gradle.daemon=true
library_version=1.1.7 library_version=1.1.8
library_archive=uniform library_archive=uniform
library_description=Cross-platform wrapper for making Brigadier commands, based on BrigadierWrapper by Tofaa2, itself inspired by emortalmcs command system. library_description=Cross-platform wrapper for making Brigadier commands, based on BrigadierWrapper by Tofaa2, itself inspired by emortalmcs command system.

@ -27,6 +27,7 @@ import com.mojang.brigadier.suggestion.Suggestion;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import net.william278.uniform.*; import net.william278.uniform.*;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -92,7 +93,7 @@ public class LegacyPaperCommand extends BaseCommand<CommandSender> {
@NotNull @NotNull
private String getUsageText() { 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")); .map("/%s"::formatted).collect(Collectors.joining("\n"));
} }

Loading…
Cancel
Save