Class CommandData.Builder
java.lang.Object
org.cloudburstmc.server.command.data.CommandData.Builder
- Enclosing class:
- CommandData
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds the alias to the set of aliases for this Command.addAliases(@NonNull String... aliases)Adds all the aliases in the passed String collection, without clearing the current aliases.addParameters(@NonNull CommandParameter[]... paramSet)Adds the set of parameters as a Command overload, without clearing the current overloads.addPermission(@NonNull String permission)Adds the passed permission String to the list of allowed permissions.addPermissions(@NonNull String... permissions)Adds all of the permissions in the passed String collection to the list of allowed permissions, without clearing the current permissions set.build()setAliases(@NonNull String... aliases)Clears the current aliases and sets the passed collection of Strings as the new aliases.setDescription(@NonNull String description)Sets the description string for this Command.setParameters(@NonNull List<CommandParameter[]> parameters)Clears the command overloads and sets the passed collection as the overloads for this Command.setParameters(@NonNull CommandParameter[]... paramSet)Clears the command overloads and sets the passed collection as the overloads for this Command.setPermissionMessage(@NonNull String message)Sets the message to send to the user when they lack the required permissions to run this Command.setPermissions(@NonNull String... permissions)Clears all current permissions and sets as the passed in collection.setUsageMessage(@NonNull String usage)Sets the usage message.
-
Constructor Details
-
Builder
-
-
Method Details
-
build
-
setDescription
Sets the description string for this Command. When sent to the client, the string will be parsed through the Server translation layer. You will need to provide theLocaleManagerwith your translation texts if you wish to use this feature.- Parameters:
description- Description string, which may contain a language file constant (ex:%commands.ban.description)- Returns:
- Builder instance for chaining calls
-
setUsageMessage
Sets the usage message. This is used when a command's execution retunsfalse, and sends the message string to the user.- Parameters:
usage- Usage string for this command (ex: "/say <message>")- Returns:
- Builder instance for chaining calls
-
setPermissionMessage
Sets the message to send to the user when they lack the required permissions to run this Command. If this is not set, the built in failure message will be sent.- Parameters:
message- Custom message to send to user if they do not have the required permission- Returns:
- Builder instance for chaining calls
-
setPermissions
Clears all current permissions and sets as the passed in collection.Note: A player only needs to have one of the permissions in the list to be able to execute the command.
- Parameters:
permissions- Collection of String premissions- Returns:
- Builder instance for chaining calls
-
addPermission
Adds the passed permission String to the list of allowed permissions.Note: A player only needs to have one of the permissions in the list to be able to execute the command.
- Parameters:
permission- Permission string to add- Returns:
- Builder instance for chaining calls
-
addPermissions
Adds all of the permissions in the passed String collection to the list of allowed permissions, without clearing the current permissions set.Note: A player only needs to have one of the permissions in the list to be able to execute the command.
- Parameters:
permissions- Collection of permissions to add- Returns:
- Builder instance for chaining calls
-
setAliases
Clears the current aliases and sets the passed collection of Strings as the new aliases.- Parameters:
aliases- Collection of String aliases for this Command- Returns:
- Builder instance for chaining calls
-
addAlias
Adds the alias to the set of aliases for this Command.- Parameters:
alias- Alias to add- Returns:
- Builder instance for chaining calls
-
addAliases
Adds all the aliases in the passed String collection, without clearing the current aliases.- Parameters:
aliases- Collection of String aliases to add to this Command.- Returns:
- Builder instance for chaining calls
-
setParameters
Clears the command overloads and sets the passed collection as the overloads for this Command.- Parameters:
paramSet- Collection ofCommandParameterarrays to set as the new overloads- Returns:
- Builder instance for chaining calls
-
setParameters
Clears the command overloads and sets the passed collection as the overloads for this Command.- Parameters:
parameters- List ofCommandParameter[]- Returns:
- Builder instance for chaining calls
-
addParameters
Adds the set of parameters as a Command overload, without clearing the current overloads.- Parameters:
paramSet- The set ofCommandParameterarrays to add to the overloads.- Returns:
- Builder instance for chaining calls
-