feat: register namespace-backed aliases on legacy paper

dependabot/gradle/org.projectlombok-lombok-1.18.34 1.0.5
William 5 months ago
parent 4f5bc46d43
commit b960c2b510
No known key found for this signature in database

@ -85,11 +85,10 @@ public class LegacyPaperCommand extends BaseCommand<BukkitBrigadierCommandSource
event.getRoot().addChild(built); event.getRoot().addChild(built);
// Register aliases // Register aliases
final String namespace = plugin.getName().toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9_-]", "");
final Set<String> aliases = Sets.newHashSet(command.getAliases()); final Set<String> aliases = Sets.newHashSet(command.getAliases());
aliases.add("%s:%s".formatted( command.getAliases().forEach(a -> aliases.add(namespace + ":" + a));
plugin.getName().toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9_]", ""), aliases.add(namespace + ":" + command.getName());
command.getName())
);
aliases.forEach(alias -> event.getRoot().addChild( aliases.forEach(alias -> event.getRoot().addChild(
LiteralArgumentBuilder.<BukkitBrigadierCommandSource>literal(alias) LiteralArgumentBuilder.<BukkitBrigadierCommandSource>literal(alias)
.requires(built.getRequirement()).executes(built.getCommand()).redirect(built) .requires(built.getRequirement()).executes(built.getCommand()).redirect(built)

Loading…
Cancel
Save