pub trait PlayerContext {
// Required methods
fn uuid(&self) -> Uuid;
fn entity_id(&self) -> i32;
fn username(&self) -> &str;
fn yaw(&self) -> f32;
fn pitch(&self) -> f32;
fn position(&self) -> (f64, f64, f64);
fn teleport(&self, x: f64, y: f64, z: f64, yaw: f32, pitch: f32);
fn set_gamemode(&self, mode: Gamemode);
fn registered_commands(&self) -> Vec<(String, String)>;
}Expand description
Player identity and state.
Required Methods§
Sourcefn position(&self) -> (f64, f64, f64)
fn position(&self) -> (f64, f64, f64)
Returns the player’s current world position. Captured at context-construction time — stale by the next tick.
Sourcefn teleport(&self, x: f64, y: f64, z: f64, yaw: f32, pitch: f32)
fn teleport(&self, x: f64, y: f64, z: f64, yaw: f32, pitch: f32)
Teleports the current player to the given coordinates.
Sourcefn set_gamemode(&self, mode: Gamemode)
fn set_gamemode(&self, mode: Gamemode)
Changes the current player’s gamemode.
Sourcefn registered_commands(&self) -> Vec<(String, String)>
fn registered_commands(&self) -> Vec<(String, String)>
Returns a list of (name, description) for all registered commands.