Trait ModStateServerHost
pub trait ModStateServerHost {
// Provided methods
fn attachment_validate_write(
&self,
token: AttachmentWriteToken,
) -> Result<(), AttachmentRowError> { ... }
fn transaction_open(&mut self) -> TransactionSeal { ... }
fn transaction_close(&mut self, seal: &TransactionSeal, commit: bool) { ... }
fn schedule_task(
&mut self,
delay_ticks: u32,
token: u64,
) -> Result<TaskId, ScheduleError> { ... }
fn cancel_task(&mut self, id: TaskId) -> bool { ... }
}Expand description
The server host’s methods of the mod_state area, implemented by the game and reached through ServerHost.
Provided Methods§
fn attachment_validate_write(
&self,
token: AttachmentWriteToken,
) -> Result<(), AttachmentRowError>
fn attachment_validate_write( &self, token: AttachmentWriteToken, ) -> Result<(), AttachmentRowError>
Side: server. Validate captured residency against the current dimension immediately before an ordinary journaled attachment write. This does not open a transaction.
fn transaction_open(&mut self) -> TransactionSeal
fn transaction_open(&mut self) -> TransactionSeal
Side: server.
Opens a transaction, nested in the open one if any (Transaction.open), and gives back
the seal that ends it. host.transaction calls it; use that instead.
fn transaction_close(&mut self, seal: &TransactionSeal, commit: bool)
fn transaction_close(&mut self, seal: &TransactionSeal, commit: bool)
Side: server.
Closes the transaction seal ends, committed or aborted, aborting first any opened
inside it and left open. Refused when seal names no open transaction, so a mod ends
only a transaction it opened. host.transaction calls it.
fn schedule_task(
&mut self,
delay_ticks: u32,
token: u64,
) -> Result<TaskId, ScheduleError>
fn schedule_task( &mut self, delay_ticks: u32, token: u64, ) -> Result<TaskId, ScheduleError>
Side: server.
Asks for Hooks::scheduled_task to be called with token after delay_ticks server
ticks (MinecraftServer.tell(new TickTask(getTickCount() + delay, ..)); 0 and 1 both
mean the next tick, and a paused server does not advance it). Tasks due together run in
the order they were scheduled. Only inside a mod’s hook; the task belongs to that mod and
is dropped with the world.
fn cancel_task(&mut self, id: TaskId) -> bool
fn cancel_task(&mut self, id: TaskId) -> bool
Side: server. Withdraws a task the calling mod scheduled: true if it was still waiting.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".