Skip to content

API reference Obsidian.API.Commands

EntitySelector class

A target selector, like @e[type=zombie,distance=..10,limit=3], or a player's name or UUID, as vanilla's entity arguments read them.

public sealed class EntitySelector

In Obsidian.API.

Remarks

Supports the selectors @p, @a, @r, @s, @e and @n, and the arguments x, y, z, distance, type, name, gamemode, level, limit and sort, where type, name and gamemode may be negated with !.

@a, @p and @r look at every online player; @e and @n at the entities of the level the command runs in.

Properties

PlayersOnly

public bool PlayersOnly { get; }

Whether the selector can only select players.

Single

public bool Single { get; }

Whether the selector can select at most one entity.

Methods

Select(CommandContext)

public IReadOnlyList<IEntity> Select(CommandContext context);

Finds the entities the selector selects for a command run in context.

SelectPlayers(CommandContext)

public IReadOnlyList<IPlayer> SelectPlayers(CommandContext context);

Finds the players the selector selects, leaving out other entities.

TryParse(string, EntitySelector)

public static bool TryParse(string input, out EntitySelector selector);

Reads a selector, or a player's name or UUID.

On this page