- Core Event Listeners (Callbacks)
- api.onPlayerJoin(player): Triggers immediately when a user enters the lobby.
- api.onPlayerLeave(player): Tracks when a player disconnects or quits.
- api.onPlayerChat(player, message): Monitors text chat; crucial for setting up custom command prefixes (like !spawn or !tp).
- api.onPlayerChangeBlock(player, blockX, blockY, blockZ, oldBlock, newBlock): Triggers when a player places or breaks a block.
- api.onRespawnRequest(player): Intercepts the moment a player dies or requests a reset.
- api.tick(): Runs continuously on every single server frame. Used for timers, zones, and real-time game loops.
- Player Manipulation Commands/Codes - Tested
- api.player.setPosition(x, y, z): Instantly teleports a player to designated coordinates.
- api.player.getVelocity() / api.player.setVelocity(x, y, z): Controls player speed, launch pads, and knockback effects.
- api.player.sendMessage("text"): Sends a private system notification directly to that player's chat feed.
- api.player.getInventory(): Checks what items or blocks the player is holding.
- World & Block Manipulation
Modifying Blocks (Active Manipulation)
-
api.changeBlock(x, y, z, "blockType")
What it does: Instantly replaces a block at specific coordinates with a new block type.
Usage: Changing an active block to a different material or spawning structures. -
api.setBlock(x, y, z, "blockType")
What it does: Forces a single block grid coordinate to become a specific item ID.
Usage: Identical to changeBlock, used interchangeably depending on server API variations. -
api.removeBlock(x, y, z)
What it does: Deletes the block at the specified coordinates, leaving empty space.
Usage: Clearing paths, resetting maps, or destroying structures.