Skip to content

Server

Represents the Minecraft server that is running the game. Provides access to server-wide operations such as loading and saving structures.

Fields

version: string Read-Only

The Minecraft version of this server.

filesystem: Filesystem Read-Only

A reference to the server's filesystem.

players: Player[] Read-Only

A list of references to all currently online players.

Methods

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

local struct = spell.server:loadStructure("arena")
spell:pasteStructure(struct)

Parameters

Name Type Description
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 Type Description
name string The name to use for saving the structure.
structure Structure The structure to save.

Returns

  • string — path The file path where the structure is saved.

getWorld(dimension: string) world: World

Returns a reference to the world for the given dimension name.

Example

local nether = spell.server:getWorld("the_nether")
player:teleport(nether, Vec3(0,64,0))

Parameters

Name Type Description
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.