feat: properly do the above

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

@ -38,6 +38,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class BukkitCommand extends BaseCommand<CommandSender> {
@ -78,12 +79,18 @@ public class BukkitCommand extends BaseCommand<CommandSender> {
// Setup command properties
this.setDescription(command.getDescription());
this.setAliases(command.getAliases());
this.setUsage(command.build().getUsageText());
this.setUsage(getUsageText());
if (permission != null) {
this.setPermission(permission.node());
}
}
@NotNull
private String getUsageText() {
return dispatcher.getSmartUsage(dispatcher.getRoot(), null).values().stream()
.map("/%s"::formatted).collect(Collectors.joining("\n"));
}
@SuppressWarnings("deprecation")
@Override
public boolean execute(@NotNull CommandSender commandSender, @NotNull String alias, @NotNull String[] args) {

@ -34,6 +34,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class LegacyPaperCommand extends BaseCommand<CommandSender> {
@ -83,12 +84,18 @@ public class LegacyPaperCommand extends BaseCommand<CommandSender> {
// Setup command properties
this.setDescription(command.getDescription());
this.setAliases(command.getAliases());
this.setUsage(command.build().getUsageText());
this.setUsage(getUsageText());
if (permission != null) {
this.setPermission(permission.node());
}
}
@NotNull
private String getUsageText() {
return dispatcher.getSmartUsage(dispatcher.getRoot(), null).values().stream()
.map("/%s"::formatted).collect(Collectors.joining("\n"));
}
@SuppressWarnings("deprecation")
@Override
public boolean execute(@NotNull CommandSender commandSender, @NotNull String alias, @NotNull String[] args) {

Loading…
Cancel
Save