Interface ModStorage
public interface ModStorage
The mod's tables in
zomboidforge.db, next to the world's save. Every table belongs to
the mod; other mods cannot reach it.
A record declares a table's columns: String, long/int,
double/float, boolean, byte[], UUID, Instant,
and enums. Primitive components cannot be null. Table and column names are snake_case
(lastPaid is stored as last_paid).
Calls block. On the main thread they are only allowed during startup (onLoad);
once the server runs they throw an IllegalStateException, so database I/O never costs
tick time. Use modThread() or async().
-
Method Summary
Modifier and TypeMethodDescription<R extends Record>
TableDefinition<R> A table with a schema version and migrations; seeTableDefinition.Opens the tablenamewith schema version 1 and no migrations.voidtransaction(Runnable work) Runsworkin one transaction: writes of this thread inside it are committed together, or not at all whenworkthrows.<T> Ttransaction(Supplier<T> work) Liketransaction(Runnable), returning the result ofwork.
-
Method Details
-
table
-
define
A table with a schema version and migrations; seeTableDefinition. -
transaction
Runsworkin one transaction: writes of this thread inside it are committed together, or not at all whenworkthrows. -
transaction
Liketransaction(Runnable), returning the result ofwork.
-