Package kr.toxicity.command.impl
Class CommandModule<W extends BetterCommandSource>
java.lang.Object
kr.toxicity.command.impl.CommandModule<W>
- Type Parameters:
W- wrapper class of command source
- All Implemented Interfaces:
CommandArgument<W>
public final class CommandModule<W extends BetterCommandSource>
extends Object
implements CommandArgument<W>
Main command module can include many sub-command
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CommandMessageAliases messagestatic final CommandMessageSub-command argument messagestatic final CommandMessageHelp command click messagestatic final CommandMessageOptional argument messagestatic final CommandMessagePermission messagestatic final CommandMessageRequired argument messagestatic final CommandMessageUnknown description message -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull String[]aliases()Gets command aliases@NotNull CommandModule<W>Sets command aliases@NotNull CommandModule<W>andPredicate(@NotNull Predicate<? super W> predicate) Sets a condition to and gate<S> @NotNull @Unmodifiable List<com.mojang.brigadier.builder.LiteralArgumentBuilder<S>>Build a brigadier command@NotNull CommandModule<W>children(@NotNull String name, @NotNull Consumer<CommandModule<? super W>> consumer) Creates children module of parent@NotNull MessageFunction<W>Gets command description@NotNull CommandModule<W>description(@NotNull String key, @NotNull net.kyori.adventure.text.Component component) Sets command description@NotNull CommandModule<W>description(@NotNull CommandMessage description) Sets command description@NotNull CommandModule<W>description(@Nullable MessageFunction<W> description) Sets command description@NotNull CommandModule<W>executes(@NotNull CommandListener executor) Sets executor of command@NotNull StringhelpName()Gets name in help command@NotNull CommandModule<W>Sets name in help command@NotNull Stringname()Gets command name@NotNull CommandModule<W>orPredicate(@NotNull Predicate<? super W> predicate) Sets a condition to and gate@Nullable StringGets command permission@NotNull CommandModule<W>permission(@Nullable String permission) Sets command permission@NotNull SenderType[]type()Gets all applicable type@NotNull CommandModule<W>type(@NotNull SenderType[] type) Sets applicable type@NotNull net.kyori.adventure.text.ComponentGets usage of this command
-
Field Details
-
REQUIRED_ARGUMENT
Required argument message -
OPTIONAL_ARGUMENT
Optional argument message -
CHILDREN
Sub-command argument message -
ALIASES
Aliases message -
PERMISSIONS
Permission message -
CLICK_MESSAGE
Help command click message -
UNKNOWN_DESCRIPTION
Unknown description message
-
-
Constructor Details
-
CommandModule
public CommandModule()
-
-
Method Details
-
name
Description copied from interface:CommandArgumentGets command name- Specified by:
namein interfaceCommandArgument<W extends BetterCommandSource>- Returns:
- name
-
aliases
Description copied from interface:CommandArgumentGets command aliases- Specified by:
aliasesin interfaceCommandArgument<W extends BetterCommandSource>- Returns:
- aliases
-
aliases
Sets command aliases- Parameters:
aliases- target aliases- Returns:
- self
-
description
Description copied from interface:CommandArgumentGets command description- Specified by:
descriptionin interfaceCommandArgument<W extends BetterCommandSource>- Returns:
- description
-
description
@NotNull public @NotNull CommandModule<W> description(@NotNull @NotNull String key, @NotNull @NotNull net.kyori.adventure.text.Component component) Sets command description- Parameters:
key- translatable keycomponent- default component if lang file is not found- Returns:
- self
-
description
Sets command description- Parameters:
description- description message- Returns:
- self
-
description
@NotNull public @NotNull CommandModule<W> description(@Nullable @Nullable MessageFunction<W> description) Sets command description- Parameters:
description- message function- Returns:
- self
-
permission
Description copied from interface:CommandArgumentGets command permission- Specified by:
permissionin interfaceCommandArgument<W extends BetterCommandSource>- Returns:
- permission key or null if not set
-
permission
Sets command permission- Parameters:
permission- target permission- Returns:
- self
-
andPredicate
@NotNull public @NotNull CommandModule<W> andPredicate(@NotNull @NotNull Predicate<? super W> predicate) Sets a condition to and gate- Parameters:
predicate- condition- Returns:
- self
-
orPredicate
@NotNull public @NotNull CommandModule<W> orPredicate(@NotNull @NotNull Predicate<? super W> predicate) Sets a condition to and gate- Parameters:
predicate- condition- Returns:
- self
-
children
@NotNull public @NotNull CommandModule<W> children(@NotNull @NotNull String name, @NotNull @NotNull Consumer<CommandModule<? super W>> consumer) Creates children module of parent- Parameters:
name- name of sub-commandconsumer- consumer of children module- Returns:
- self
-
type
Gets all applicable type- Returns:
- all type
-
type
Sets applicable type- Parameters:
type- type- Returns:
- self
-
helpName
Gets name in help command- Returns:
- name in help command
-
helpName
Sets name in help command- Parameters:
helpName- name- Returns:
- self
-
usage
Description copied from interface:CommandArgumentGets usage of this command- Specified by:
usagein interfaceCommandArgument<W extends BetterCommandSource>- Parameters:
w- source- Returns:
- usage component
-
executes
Sets executor of command- Parameters:
executor- command executor- Returns:
- self
-
build
@NotNull public <S> @NotNull @Unmodifiable List<com.mojang.brigadier.builder.LiteralArgumentBuilder<S>> build(@NotNull @NotNull Function<S, W> mapper) Description copied from interface:CommandArgumentBuild a brigadier command- Specified by:
buildin interfaceCommandArgument<W extends BetterCommandSource>- Type Parameters:
S- source class of W (normally it is a CommandSourceStack)- Parameters:
mapper- class wrapper- Returns:
- brigadier command
-