Class CommandData.Builder

java.lang.Object
org.cloudburstmc.server.command.data.CommandData.Builder
Enclosing class:
CommandData

public static class CommandData.Builder extends Object
  • Constructor Details

    • Builder

      public Builder(@NonNull @NonNull String name)
  • Method Details

    • build

      public CommandData build()
    • setDescription

      public CommandData.Builder setDescription(@NonNull @NonNull String description)
      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 the LocaleManager with 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

      public CommandData.Builder setUsageMessage(@NonNull @NonNull String usage)
      Sets the usage message. This is used when a command's execution retuns false, 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

      public CommandData.Builder setPermissionMessage(@NonNull @NonNull String message)
      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

      public CommandData.Builder setPermissions(@NonNull @NonNull String... permissions)
      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

      public CommandData.Builder addPermission(@NonNull @NonNull String permission)
      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

      public CommandData.Builder addPermissions(@NonNull @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.

      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

      public CommandData.Builder setAliases(@NonNull @NonNull String... aliases)
      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

      public CommandData.Builder addAlias(@NonNull @NonNull String alias)
      Adds the alias to the set of aliases for this Command.
      Parameters:
      alias - Alias to add
      Returns:
      Builder instance for chaining calls
    • addAliases

      public CommandData.Builder addAliases(@NonNull @NonNull String... aliases)
      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

      public CommandData.Builder setParameters(@NonNull @NonNull CommandParameter[]... paramSet)
      Clears the command overloads and sets the passed collection as the overloads for this Command.
      Parameters:
      paramSet - Collection of CommandParameter arrays to set as the new overloads
      Returns:
      Builder instance for chaining calls
    • setParameters

      public CommandData.Builder setParameters(@NonNull @NonNull List<CommandParameter[]> parameters)
      Clears the command overloads and sets the passed collection as the overloads for this Command.
      Parameters:
      parameters - List of CommandParameter[]
      Returns:
      Builder instance for chaining calls
    • addParameters

      public CommandData.Builder addParameters(@NonNull @NonNull CommandParameter[]... paramSet)
      Adds the set of parameters as a Command overload, without clearing the current overloads.
      Parameters:
      paramSet - The set of CommandParameter arrays to add to the overloads.
      Returns:
      Builder instance for chaining calls