fix: namespace-backed aliases not being registered, close #795

This commit is contained in:
William278 committed 2025-03-15 13:33:02 +00:00
1 parent 1590c847b5
commit 18cda2da3c
1 file changed
+7 -3
@@ -73,10 +73,14 @@ public class FabricCommand {
// Register aliases
final LiteralCommandNode<ServerCommandSource> node = dispatcher.register(builder);
dispatcher.register(literal("huskhomes:" + command.getName())
dispatcher.register(literal("huskhomes:%s".formatted(command.getName()))
.requires(predicate).executes(getBrigadierExecutor()).redirect(node));
command.getAliases().forEach(alias -> dispatcher.register(literal(alias)
.requires(predicate).executes(getBrigadierExecutor()).redirect(node)));
command.getAliases().forEach(alias -> {
dispatcher.register(literal(alias).requires(predicate)
.executes(getBrigadierExecutor()).redirect(node));
dispatcher.register(literal("huskhomes:%s".formatted(alias)).requires(predicate)
.executes(getBrigadierExecutor()).redirect(node));
});
}
private com.mojang.brigadier.Command<ServerCommandSource> getBrigadierExecutor() {