fix /papi command showing error, add /placeholderapi alias

This commit is contained in:
PiggyPiglet
2026-01-26 21:31:43 +08:00
parent 62f6eb4e54
commit 98b7ef68ec

View File

@@ -71,7 +71,7 @@ public final class PlaceholderCommandRouter extends AbstractCommand {
public PlaceholderCommandRouter(@NotNull final PlaceholderAPIPlugin plugin) { public PlaceholderCommandRouter(@NotNull final PlaceholderAPIPlugin plugin) {
super("papi", "papi"); super("papi", "papi");
// addAliases("placeholderapi"); addAliases("placeholderapi");
setAllowsExtraArguments(true); setAllowsExtraArguments(true);
this.plugin = plugin; this.plugin = plugin;
@@ -132,10 +132,10 @@ public final class PlaceholderCommandRouter extends AbstractCommand {
@Override @Override
protected @Nullable CompletableFuture<Void> execute(@NotNull final CommandContext context) { protected @Nullable CompletableFuture<Void> execute(@NotNull final CommandContext context) {
final String[] args = context.getInputString().replace("papi ", "").split(" "); final String[] args = context.getInputString().replace("papi", "").replace("placeholderapi", "").trim().split(" ");
final CommandSender sender = context.sender(); final CommandSender sender = context.sender();
if (args.length == 0) { if (args.length == 0 || args[0].isBlank()) {
final PlaceholderCommand fallback = commands.get("version"); final PlaceholderCommand fallback = commands.get("version");
if (fallback != null) { if (fallback != null) {
fallback.evaluate(plugin, sender, "", Collections.emptyList()); fallback.evaluate(plugin, sender, "", Collections.emptyList());