Class CommandBuilder
-
public final class CommandBuilderIf you are using Kotlin, you can use this class to create Brigadier commands Kotlin-style.
You should probably implement your own command system if you are making your own addon, rather than using anything from Pylon Core. We recommend checking out Aikar's commands, as it makes adding commands very easy and simple.
(Blame Kotlin for not allowing us to hide this class in any way from Java).
-
-
Constructor Summary
Constructors Constructor Description CommandBuilder(ArgumentBuilder<CommandSourceStack, ?> command)
-
Method Summary
Modifier and Type Method Description final ArgumentBuilder<CommandSourceStack, ?>getCommand()final Function2<CommandContext<CommandSourceStack>, CommandSender, Boolean>getRequirement()final voidsetRequirement(Function2<CommandContext<CommandSourceStack>, CommandSender, Boolean> value)final CommandNode<CommandSourceStack>literal(String name, Function1<CommandBuilder, Unit> block)final CommandNode<CommandSourceStack>argument(String name, ArgumentType<?> type, Function1<CommandBuilder, Unit> block)final voidthen(CommandNode<CommandSourceStack> node)final voidrequires(Component errorMessage, Function2<CommandContext<CommandSourceStack>, CommandSender, Boolean> predicate)final voidpermission(String permission)final voidredirect(CommandNode<CommandSourceStack> node)final voidexecutes(Function2<CommandContext<CommandSourceStack>, CommandSender, Unit> handler)final voidexecutesWithPlayer(Function2<CommandContext<CommandSourceStack>, Player, Unit> handler)final CommandNode<CommandSourceStack>build()-
-
Constructor Detail
-
CommandBuilder
CommandBuilder(ArgumentBuilder<CommandSourceStack, ?> command)
-
-
Method Detail
-
getCommand
final ArgumentBuilder<CommandSourceStack, ?> getCommand()
-
getRequirement
final Function2<CommandContext<CommandSourceStack>, CommandSender, Boolean> getRequirement()
-
setRequirement
final void setRequirement(Function2<CommandContext<CommandSourceStack>, CommandSender, Boolean> value)
-
literal
final CommandNode<CommandSourceStack> literal(String name, Function1<CommandBuilder, Unit> block)
-
argument
final CommandNode<CommandSourceStack> argument(String name, ArgumentType<?> type, Function1<CommandBuilder, Unit> block)
-
then
final void then(CommandNode<CommandSourceStack> node)
-
requires
final void requires(Component errorMessage, Function2<CommandContext<CommandSourceStack>, CommandSender, Boolean> predicate)
-
permission
final void permission(String permission)
-
redirect
final void redirect(CommandNode<CommandSourceStack> node)
-
executes
final void executes(Function2<CommandContext<CommandSourceStack>, CommandSender, Unit> handler)
-
executesWithPlayer
final void executesWithPlayer(Function2<CommandContext<CommandSourceStack>, Player, Unit> handler)
-
build
final CommandNode<CommandSourceStack> build()
-
-
-
-