BedrioxDOCUMENTATION
PLUGIN DEVELOPMENT

Players

Server::getOnlinePlayers() returns immutable snapshots of currently connected players. A snapshot exposes stable identity and current state while its action capabilities safely target that session.

Find and inspect players

PHP
foreach ($this->context()->server()->getOnlinePlayers() as $player) {
    $this->logger()->info("{$player->name} is online");
}

Use the UUID for durable identity. Names can change. Check isConnected() before work that may occur after a delay.

Displays and communication

The public player connection supports ordinary messages plus titles, subtitles, popups, action bars, toasts, and typed translated messages. Prefer the narrowest display that fits the information; repeating status belongs in an action bar or popup rather than chat.

Authoritative player actions

Player snapshots can request teleportation, game-mode changes, damage, kicks, arm swings, effects, experience changes, and inventory operations. These calls enter normal Bedriox validation and events.

PHP
use Bedriox\Api\Player\GameMode;
use Bedriox\Api\Player\Player;
use Bedriox\Api\World\Position;

private function prepareForArena(Player $player, Position $destination): void
{
    $player->teleport($destination);
    $player->setGameMode(GameMode::ADVENTURE);
    $player->damage(2.0);
}

The caller supplies the connected $player and a resolved $destination containing the target world, coordinates, yaw, and pitch. A typed command can provide both values with onlinePlayer() and position() parameters.

After a timer or async result, resolve the player again by UUID instead of retaining an old snapshot.