Trait Commands
pub trait Commands {
// Provided methods
fn refresh_commands(&mut self) { ... }
fn feedback(&mut self, line: Text) -> Result<(), TextFormError> { ... }
fn run_command(&mut self, line: &str) -> bool { ... }
}Expand description
The commands service, reached through its host.
Provided Methods§
fn refresh_commands(&mut self)
fn refresh_commands(&mut self)
Side: server.
A mod changed the commands it registers (native_register_commands):
at the start of the next server tick every mod is asked again, the
commands players may run are rebuilt, and every player on the server is
sent their tree again, after native_player_commands_sent. Nothing
happens where no world is open to players, and nothing for a server
whose mods never call it. API @API:refresh_commands@.
fn feedback(&mut self, line: Text) -> Result<(), TextFormError>
fn feedback(&mut self, line: Text) -> Result<(), TextFormError>
Side: server. A command’s success feedback, routed to its originating source using vanilla’s silence, send-command-feedback and block/cart track-output rules. Refuses text deeper than 512 component nodes before applying any changes.
fn run_command(&mut self, line: &str) -> bool
fn run_command(&mut self, line: &str) -> bool
Side: server.
Runs line (no slash) as the server’s console does: permission
level 4, from the overworld’s spawn, with no output. A teleport to
another level (execute in minecraft:the_nether run tp Alex 0 70 0)
happens at the next tick’s start, as the console’s. Whether it ran
without failing. During a guest’s turn, live players (including the
acting player) are reachable; displaced outer players are excluded
from name, UUID and selector resolution on this path only.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".