Skip to main content

Players

Trait Players 

pub trait Players {
    // Provided methods
    fn server_players(&self) -> Vec<PlayerRef> { ... }
    fn player_by_name(&self, name: &str) -> Option<PlayerRef> { ... }
    fn acting_player(&self) -> Option<PlayerRef> { ... }
}
Expand description

The players service, reached through its host.

Provided Methods§

fn server_players(&self) -> Vec<PlayerRef>

Side: server. The players on this server, in the order they joined. Empty on a client and in a world nobody else can join.

fn player_by_name(&self, name: &str) -> Option<PlayerRef>

Side: server. Find a connected player by their account name, case-insensitively.

fn acting_player(&self) -> Option<PlayerRef>

Side: server. The player whose action or command a hook hears, as their state is swapped in (native_run_mod_command, native_right_click_block, native_use_on, native_break_block…): None outside such a hook.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§