Skip to main content

ConfigServerHost

Trait ConfigServerHost 

pub trait ConfigServerHost {
    // Provided methods
    fn tick_stats(&self) -> (f32, f64) { ... }
    fn set_tick_rate(&mut self, rate: f32) -> bool { ... }
    fn world_dir(&self) -> Option<PathBuf> { ... }
    fn reload_resources(&self) -> &dyn ServerReloadResources { ... }
}
Expand description

The server host’s methods of the config area, implemented by the game and reached through ServerHost.

Provided Methods§

fn tick_stats(&self) -> (f32, f64)

Side: server. The server’s tick rate (20 unless /tick rate changed it) and the milliseconds its ticks took on average lately, as /tick query reports them. The ticks a second it keeps up is the rate, or 1000 / milliseconds when that is lower.

fn set_tick_rate(&mut self, rate: f32) -> bool

Side: server. Sets the server’s tick rate, as /tick rate does (ServerTickRateManager.setTickRate): the game ticks rate times a second from the next tick on, an autosave wait already running is shortened when the new rate asks for less, and server_tick_rate_changed fires. The players’ clients follow on the next sync. False, with nothing changed, for a rate outside 1 to 10000 (the command’s range), one that isn’t finite, a call from inside server_tick_rate_changed (which would hear itself again without end), or on a client.

fn world_dir(&self) -> Option<PathBuf>

Side: server. The open world’s folder (world/, beside its level.dat): a server mod keeps its data in a folder of its own there, so the world’s backups carry it. None when no world is open.

Not on wasm: a path in the game’s file system, which a wasm mod has none of; a wasm mod keeps world data in level attachments.

fn reload_resources(&self) -> &dyn ServerReloadResources

Side: server. The retained server reload listeners of the last successful reload.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§