Java Code Examples for com.mojang.brigadier.tree.CommandNode#addChild()
The following examples show how to use
com.mojang.brigadier.tree.CommandNode#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: SpreadPlayersCommand.java From multiconnect with MIT License | 5 votes |
public static void register(CommandDispatcher<CommandSource> dispatcher) { CommandNode<CommandSource> respectTeams = argument("respectTeams", bool()) .executes(ctx -> 0) .build(); CommandNode<CommandSource> target = argument("target", entities()) .executes(ctx -> 0) .redirect(respectTeams) .build(); respectTeams.addChild(target); dispatcher.register(literal("spreadplayers") .then(argument("center", vec2()) .then(argument("spreadDistance", doubleArg(0)) .then(argument("maxRange", doubleArg(1)) .then(respectTeams))))); }
Example 2
Source File: ScoreboardCommand.java From multiconnect with MIT License | 5 votes |
private static CommandNode<CommandSource> addPlayerList(ArgumentBuilder<CommandSource, ?> parentBuilder) { CommandNode<CommandSource> parent = parentBuilder.executes(ctx -> 0).build(); CommandNode<CommandSource> child = argument("player", entities()) .executes(ctx -> 0) .redirect(parent) .build(); parent.addChild(child); return parent; }