Package com.ldtteam.structurize.commands
Class AbstractCommand.CommandTree
java.lang.Object
com.ldtteam.structurize.commands.AbstractCommand.CommandTree
- Enclosing class:
AbstractCommand
Class for building command trees efectively
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommandTree(net.minecraft.commands.Commands.CommandSelection environment, String commandName) Creates new command tree. -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractCommand.CommandTreeAdds new tree as leaf into this tree.protected AbstractCommand.CommandTreeaddNode(Supplier<com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack>> commandBuilder, Supplier<net.minecraft.commands.Commands.CommandSelection> commandEnviroment) Adds new command as leaf into this tree.protected Optional<com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack>> build(net.minecraft.commands.Commands.CommandSelection environment) Builds whole tree for dispatcher.protected static AbstractCommand.CommandTreeprotected voidregister(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> commandDispatcher, net.minecraft.commands.Commands.CommandSelection serverEnvironmentType)
-
Constructor Details
-
CommandTree
protected CommandTree(net.minecraft.commands.Commands.CommandSelection environment, String commandName) Creates new command tree.- Parameters:
commandName- root vertex name
-
-
Method Details
-
newRootNode
- Returns:
- constructs new root node
-
addNode
Adds new tree as leaf into this tree.- Parameters:
tree- new tree to add- Returns:
- this
-
addNode
protected AbstractCommand.CommandTree addNode(Supplier<com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack>> commandBuilder, Supplier<net.minecraft.commands.Commands.CommandSelection> commandEnviroment) Adds new command as leaf into this tree.- Parameters:
commandBuilder- command to addcommandEnviroment- command's enviroment getter- Returns:
- this
-
build
protected Optional<com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack>> build(net.minecraft.commands.Commands.CommandSelection environment) Builds whole tree for dispatcher.- Returns:
- tree as command node
-
register
protected void register(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> commandDispatcher, net.minecraft.commands.Commands.CommandSelection serverEnvironmentType)
-