Enum Class RunAs
- All Implemented Interfaces:
Serializable,Comparable<RunAs>,Constable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
-
Enum Constant Details
-
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
playerfield ofCommandPayloadmay benull. -
PLAYER
Executes the command as a specific player with their normal permissions.The command runs with the target player's permission set. The
playerfield ofCommandPayloadmust be set to the UUID of an online player. If the player is not online, execution may be queued depending on bridge configuration. -
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
playerfield ofCommandPayloadmust be set. Use this mode only when elevated permissions are required; preferPLAYERfor normal user commands.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-