Package org.geysermc.geyser.api.command
Interface Command.Builder<T extends CommandSource>
- Enclosing interface:
- Command
public static interface Command.Builder<T extends CommandSource>
-
Method Summary
Modifier and TypeMethodDescriptionSets the aliases.bedrockOnly(boolean bedrockOnly) Sets if this command can only be executed by bedrock players.@NonNull Commandbuild()Builds the command.description(@NonNull String description) Sets the command description.executableOnConsole(boolean executableOnConsole) Deprecated, for removal: This API element is subject to removal in a future version.executor(@NonNull CommandExecutor<T> executor) Sets theCommandExecutorfor this command.Sets the command name.permission(@NonNull String permission) Sets the permission node required to run this command.permission(@NonNull String permission, @NonNull TriState defaultValue) Deprecated.this method is experimental and may be removed in the futureplayerOnly(boolean playerOnly) Sets if this command can only be executed by players.Defines the source type to use for this command.default Command.Builder<T>subCommands(@NonNull List<String> subCommands) Deprecated, for removal: This API element is subject to removal in a future version.this method has no effectsuggestedOpOnly(boolean suggestedOpOnly) Deprecated, for removal: This API element is subject to removal in a future version.this method is not guaranteed to produce meaningful or expected results
-
Method Details
-
source
Defines the source type to use for this command.Command source types can be anything that extend
CommandSource, such asGeyserConnection. This will guarantee that the source used in the executor is an instance of this source.- Parameters:
sourceType- the source type- Returns:
- this builder
-
name
Sets the command name.- Parameters:
name- the command name- Returns:
- this builder
-
description
Sets the command description.- Parameters:
description- the command description- Returns:
- this builder
-
permission
Sets the permission node required to run this command.
It will not be registered with any permission registries, such as an underlying server, or a permissions Extension (unlikepermission(String, TriState)).- Parameters:
permission- the permission node- Returns:
- this builder
-
permission
@Deprecated Command.Builder<T> permission(@NonNull String permission, @NonNull TriState defaultValue) Deprecated.this method is experimental and may be removed in the futureSets the permission node and its default value. The usage of the default value is platform dependant and may or may not be used. For example, it may be registered to an underlying server.Extensions may instead listen for
GeyserRegisterPermissionsEventto register permissions, especially if the same permission is required by multiple commands. Also see this event for TriState meanings.- Parameters:
permission- the permission nodedefaultValue- the node's default value- Returns:
- this builder
-
aliases
Sets the aliases.- Parameters:
aliases- the aliases- Returns:
- this builder
-
suggestedOpOnly
Deprecated, for removal: This API element is subject to removal in a future version.this method is not guaranteed to produce meaningful or expected resultsSets if this command is designed to be used only by server operators.- Parameters:
suggestedOpOnly- if this command is designed to be used only by server operators- Returns:
- this builder
-
executableOnConsole
Deprecated, for removal: This API element is subject to removal in a future version.useCommand.isPlayerOnly()instead (inverted)Sets if this command is executable on console.- Parameters:
executableOnConsole- if this command is executable on console- Returns:
- this builder
-
playerOnly
Sets if this command can only be executed by players.- Parameters:
playerOnly- if this command is player only- Returns:
- this builder
-
bedrockOnly
Sets if this command can only be executed by bedrock players.- Parameters:
bedrockOnly- if this command is bedrock only- Returns:
- this builder
-
subCommands
@Deprecated(forRemoval=true) default Command.Builder<T> subCommands(@NonNull List<String> subCommands) Deprecated, for removal: This API element is subject to removal in a future version.this method has no effectSets the subcommands.- Parameters:
subCommands- the subcommands- Returns:
- this builder
-
executor
Sets theCommandExecutorfor this command.- Parameters:
executor- the command executor- Returns:
- this builder
-
build
@NonNull Command build()Builds the command.- Returns:
- a new command from this builder
-
Command.isPlayerOnly()instead (inverted)