Interface Command.Builder<T extends CommandSource>

Enclosing interface:
Command

public static interface Command.Builder<T extends CommandSource>
  • Method Details

    • source

      Command.Builder<T> source(Class<? extends T> sourceType)
      Defines the source type to use for this command.

      Command source types can be anything that extend CommandSource, such as GeyserConnection. 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

      Command.Builder<T> name(String name)
      Sets the command name.
      Parameters:
      name - the command name
      Returns:
      this builder
    • description

      Command.Builder<T> description(String description)
      Sets the command description.
      Parameters:
      description - the command description
      Returns:
      this builder
    • permission

      Command.Builder<T> permission(String 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 (unlike permission(String, TriState)).
      Parameters:
      permission - the permission node
      Returns:
      this builder
    • permission

      @Deprecated Command.Builder<T> permission(String permission, TriState defaultValue)
      Deprecated.
      this method is experimental and may be removed in the future
      Sets 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 GeyserRegisterPermissionsEvent to register permissions, especially if the same permission is required by multiple commands. Also see this event for TriState meanings.

      Parameters:
      permission - the permission node
      defaultValue - the node's default value
      Returns:
      this builder
    • aliases

      Command.Builder<T> aliases(List<String> aliases)
      Sets the aliases.
      Parameters:
      aliases - the aliases
      Returns:
      this builder
    • suggestedOpOnly

      @Deprecated(forRemoval=true) Command.Builder<T> suggestedOpOnly(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
      Sets 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(forRemoval=true) Command.Builder<T> executableOnConsole(boolean executableOnConsole)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use Command.isPlayerOnly() instead (inverted)
      Sets if this command is executable on console.
      Parameters:
      executableOnConsole - if this command is executable on console
      Returns:
      this builder
    • playerOnly

      Command.Builder<T> playerOnly(boolean playerOnly)
      Sets if this command can only be executed by players.
      Parameters:
      playerOnly - if this command is player only
      Returns:
      this builder
    • bedrockOnly

      Command.Builder<T> bedrockOnly(boolean 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(List<String> subCommands)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method has no effect
      Sets the subcommands.
      Parameters:
      subCommands - the subcommands
      Returns:
      this builder
    • executor

      Command.Builder<T> executor(CommandExecutor<T> executor)
      Sets the CommandExecutor for this command.
      Parameters:
      executor - the command executor
      Returns:
      this builder
    • build

      Command build()
      Builds the command.
      Returns:
      a new command from this builder