Skip to content

API reference Obsidian.API

CommandContext class

public sealed class CommandContext

In Obsidian.API.

Constructors

public CommandContext(string message, ICommandSender commandSender, IPlayer player, IServer server);

Properties

Executor

public IEntity Executor { get; init; }

The entity the command runs as, which @s selects: the player who sent it, or the entity /execute as chose.

public bool IsPlayer { get; }

Level

public ILevel Level { get; init; }

The level the command runs in: the executor's unless /execute at or in changed it, else the default world.

Origin

public VectorD? Origin { get; init; }

Where the command runs, which relative coordinates and selector distances are measured from: the executor's position unless /execute at or positioned moved it.

public IPlayer Player { get; }public PluginBase Plugin { get; }public int Result { get; }

Rotation

public (float, float)? Rotation { get; init; }

The rotation local (^) coordinates are measured along: the executor's unless /execute rotated or at changed it.

public ICommandSender Sender { get; }

Server

public IServer Server { get; }

The server the command runs on. A plugin's command gets the plugin's own IServer, whose additions are the plugin's (see BaseMinecraftEventArgs.Server).

Succeeded

public bool Succeeded { get; }

The outcome of the last command, including a successful command whose result is zero.

Methods

SetResult(bool, int)

public void SetResult(bool succeeded, int result = 0);

Records the value consumed by command composition, independently of feedback messages.

On this page