Enum Class RunAs

java.lang.Object
java.lang.Enum<RunAs>
dev.objz.commandbridge.api.channel.command.RunAs
All Implemented Interfaces:
Serializable, Comparable<RunAs>, Constable

public enum RunAs extends Enum<RunAs>
Defines the execution context for a command dispatched through the CommandBridge network.

Each constant controls which identity the backend server uses when running the command. The three modes cover the full range of execution contexts: server-side administrative commands, user-context commands with normal permissions, and elevated commands that temporarily grant operator status to a specific player.

To run a command as the server console, with full permissions and no player context:


 new CommandPayload("say hello", RunAs.CONSOLE)
 

To run a command as a specific online player, with their normal permissions:


 new CommandPayload("home", RunAs.PLAYER, playerUUID)
 

To run a command as a player with temporary operator-level permissions:


 new CommandPayload("gamemode creative", RunAs.OPERATOR, playerUUID)
 
See Also:
  • Enum Constant Details

    • CONSOLE

      public static final RunAs CONSOLE
      Executes the command as the server console.

      The command runs with full server-side permissions, unrestricted by player permission nodes. No player context is required; the player field of CommandPayload may be null.

    • PLAYER

      public static final RunAs PLAYER
      Executes the command as a specific player with their normal permissions.

      The command runs with the target player's permission set. The player field of CommandPayload must be set to the UUID of an online player. If the player is not online, execution may be queued depending on bridge configuration.

    • OPERATOR

      public static final RunAs OPERATOR
      Executes the command as a specific player with temporary operator-level permissions.

      Operator status is granted to the player for the duration of the command and revoked immediately after. The player field of CommandPayload must be set. Use this mode only when elevated permissions are required; prefer PLAYER for normal user commands.

  • Method Details

    • values

      public static RunAs[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RunAs valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null