Skip to content

CommandSource

Namespace Mc.Scripting.Commands · Kind class (sealed)

public sealed class CommandSource

Who runs a command: a player or the console, with a permission level, a position and a dimension.

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.
public Entity Entity { get; }

The executing entity (Entity.Null for the console and command blocks).

public bool IsConsole { get; }

Whether the command runs from the server console.

public int PermissionLevel { get; }

The vanilla permission level of the source (0-4).

public Player? Player { get; }

The executing player, null when the console or another entity runs the command.

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.

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).
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.
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.

Entity · Player · Vec3d · World