Skip to content

Latest commit

 

History

History
72 lines (44 loc) · 2.81 KB

managers.md

File metadata and controls

72 lines (44 loc) · 2.81 KB

Server Managers

Bans Manager (bansManager.js)

The Bans Manager handles player bans. Key methods include:

  • addBan(ip: string, reason: string, duration: number|string = Infinity): Adds a ban for an IP address. Example: addBan('192.168.1.1', 'Spamming', '2h30m')

  • removeBan(ip: string): Removes a ban for an IP address. Example: removeBan('192.168.1.1')

  • getBan(ip: string): Retrieves ban information for an IP address. Example: const banInfo = getBan('192.168.1.1')

Mutes Manager (mutesManager.js)

The Mutes Manager handles player mutes. Key methods include:

  • addMute(id: string, reason: string, duration: number|string = Infinity): Adds a mute for a player ID. Example: addMute('12345', 'Spamming', '2h30m')

  • removeMute(id: string): Removes a mute for a player ID. Example: removeMute('12345')

  • getMute(id: string): Retrieves mute information for a player ID. Example: const muteInfo = getMute('12345')

Line Manager (lineManager.js)

The Line Manager handles drawing and erasing lines. Key methods include:

  • draw_line(worldName: string, from: number[], to: number[]): Draws a line in the specified world. Example: draw_line('main', [0, 0], [10, 10])

  • erase_line(worldName: string, from: number[], to: number[]): Erases a line in the specified world. Example: erase_line('main', [0, 0], [10, 10])

Text Manager (textManager.js)

The Text Manager handles setting and deleting text. Key methods include:

  • set_text(worldName: string, text: string, x: number, y: number): Sets text at specified coordinates in the world. Example: set_text('main', 'Hello World', 100, 100)

  • del_text(worldName: string, x: number, y: number): Deletes text at specified coordinates in the world. Example: del_text('main', 100, 100)

Chunk Manager (chunkManager.js)

The Chunk Manager handles chunk-related operations. Key methods include:

  • get_chunkdata(worldName: string, chunkX: number, chunkY: number): Retrieves chunk data. Example: const chunkData = get_chunkdata('main', 0, 0)

  • set_chunkdata(worldName: string, chunkX: number, chunkY: number, chunkData: number[][][]): Sets chunk data. Example: set_chunkdata('main', 0, 0, newChunkData)

  • set_pixel(worldName: string, x: number, y: number, color: number[]): Sets a pixel's color. Example: set_pixel('main', 10, 10, [255, 0, 0])

World Manager (worldManager.js)

The World Manager handles world-related operations. Key methods include:

  • initWorld(worldName: string): Initializes a new world. Example: const newWorld = initWorld('newWorld')

  • getWorldByName(worldName: string): Retrieves a world by its name. Example: const world = getWorldByName('main')

These managers provide essential functionality for managing various aspects of the server and game world.