Server¶
Represents the Minecraft server that is running the game. Provides access to server-wide operations such as loading and saving structures.
Fields¶
filesystem: Filesystem — Read-Only¶
A reference to the server's filesystem.
players: Player[ ] — Read-Only¶
A list of references to all currently online players.
version: string — Read-Only¶
The Minecraft version of this server.
Methods¶
getWorld(dimension: string) → world: World¶
Returns a reference to the world for the given dimension name.
Example
Parameters
- dimension: string — The name of the dimension, e.g. "the_nether" or "overworld"
Returns
- world: World — A reference to the world that represents the given dimension.
loadStructure(name: string) → structure: Structure¶
Loads a Structure from the server's filesystem or internal repository by its name.
Returns a Structure object that can be pasted into the world or inspected.
Example: Load and paste a structure
Parameters
- name: string — The name of the structure to load.
Returns
- structure: Structure — The loaded structure object.
saveStructure(name: string, structure: Structure) → path: string¶
Saves a Structure to the server's filesystem with the given name.
Returns the file path where the structure was saved.
Example: Copy and save a structure
local struct = spell:copyStructure(spell.pos + Vec3(10, 10, 10))
local path = spell.server:saveStructure("arena", struct)
print("Saved at " .. path)
Parameters
- name: string — The name to use for saving the structure.
- structure: Structure — The structure to save.
Returns
- path: string — The file path where the structure is saved.