CommandSource
Namespace Mc.Scripting.Commands · Kind class (sealed)
public sealed class CommandSourceWho runs a command: a player or the console, with a permission level, a position and a dimension.
Properties
Section titled “Properties”| Member | Description |
|---|---|
Entity Entity { get; } |
The executing entity (Entity.Null for the console and command blocks). |
bool IsConsole { get; } |
Whether the command runs from the server console. |
int PermissionLevel { get; } |
The vanilla permission level of the source (0-4). |
Player? Player { get; } |
The executing player, null when the console or another entity runs the command. |
Vec3d Position { get; } |
The position the command runs at (the entity’s position for players; the origin for the console). |
World World { get; } |
The dimension the command runs in. |
Entity
Section titled “Entity”public Entity Entity { get; }The executing entity (Entity.Null for the console and command blocks).
IsConsole
Section titled “IsConsole”public bool IsConsole { get; }Whether the command runs from the server console.
PermissionLevel
Section titled “PermissionLevel”public int PermissionLevel { get; }The vanilla permission level of the source (0-4).
Player
Section titled “Player”public Player? Player { get; }The executing player, null when the console or another entity runs the command.
Position
Section titled “Position”public Vec3d Position { get; }The position the command runs at (the entity’s position for players; the origin for the console).
public World World { get; }The dimension the command runs in.
Methods
Section titled “Methods”| Member | Description |
|---|---|
void Failure(string message) |
Sends a red failure message to the source (the command is not aborted). |
void Success(string message, bool broadcastToOps = false) |
Sends feedback to the source (and, like vanilla, to operators when broadcastToOps is set). |
Failure
Section titled “Failure”public void Failure(string message)Sends a red failure message to the source (the command is not aborted).
Parameters
| Name | Type | Description |
|---|---|---|
message |
string |
The text. |
Success
Section titled “Success”public void Success(string message, bool broadcastToOps = false)Sends feedback to the source (and, like vanilla, to operators when broadcastToOps is set).
Parameters
| Name | Type | Description |
|---|---|---|
message |
string |
The text. |
broadcastToOps |
bool = false |
Whether operators with feedback enabled see it as well. |