Java Code Examples for com.mojang.brigadier.tree.LiteralCommandNode#addChild()
The following examples show how to use
com.mojang.brigadier.tree.LiteralCommandNode#addChild() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LiteralArgumentBuilder.java From brigadier with MIT License | 5 votes |
@Override public LiteralCommandNode<S> build() { final LiteralCommandNode<S> result = new LiteralCommandNode<>(getLiteral(), getCommand(), getRequirement(), getRedirect(), getRedirectModifier(), isFork()); for (final CommandNode<S> argument : getArguments()) { result.addChild(argument); } return result; }
Example 2
Source File: HallowedCommands.java From the-hallow with MIT License | 4 votes |
private static void register(CommandDispatcher<ServerCommandSource> dispatcher) { RootCommandNode<ServerCommandSource> root = dispatcher.getRoot(); LiteralCommandNode<ServerCommandSource> baseCmd = literal("spook").executes(HallowedCommand::run).build(); LiteralCommandNode<ServerCommandSource> spooktober = literal("spooktober").executes(SpooktoberCommand::run).build(); LiteralCommandNode<ServerCommandSource> contributors = literal("contributors").executes(ContibutorsCommand::run).build(); root.addChild(baseCmd); root.addChild(spooktober); baseCmd.addChild(spooktober); baseCmd.addChild(contributors); dispatcher.register(literal("the-hallow").redirect(baseCmd)); }