Skip to content

Omegga API

Isaac Hirschfeld edited this page Dec 21, 2020 · 6 revisions

Omegga API

The following fields, methods, and events are available to omegga.plugin.js plugins

Omegga

Kind: global class

omegga._tempSaveCounter

The save counter prevents omegga from saving over the same file

Kind: instance property of Omegga

omegga._tempSavePrefix

The save prefix is prepended to all temporary saves

Kind: instance property of Omegga

omegga.players

list of online players

Kind: instance property of Omegga

omegga.host

host player info {id: uuid, name: player name}

Kind: instance property of Omegga

omegga.version

current game version - may later be turned into CL#### versions

Kind: instance property of Omegga

omegga.started

whether server has started

Kind: instance property of Omegga

omegga.starting

whether server is starting up

Kind: instance property of Omegga

omegga.start() ⇒ Promise

start webserver, load plugins, start the brickadia server this should not be called by a plugin

Kind: instance method of Omegga

omegga.stop() ⇒ Promise

unload plugins and stop the server this should not be called by a plugin

Kind: instance method of Omegga

omegga.copyAuthFiles()

Copies auth files from home config dir this should never be called by a plugin

Kind: instance method of Omegga

omegga.broadcast(...messages)

broadcast messages to chat messages are broken by new line multiple arguments are additional lines all messages longer than 512 characters are deleted automatically, though omegga wouldn't have sent them anyway

Kind: instance method of Omegga

Param Type Description
...messages messages unescaped chat messages to send. may need to wrap messages with quotes

omegga.whisper(...target)

whisper messages to chat messages are broken by new line multiple arguments are additional lines all messages longer than 512 characters are deleted automatically, though omegga wouldn't have sent them anyway

Kind: instance method of Omegga

Param Type Description
...target messages unescaped chat messages to send. may need to wrap messages with quotes

omegga.getPlayers() ⇒ players

get a list of players

Kind: instance method of Omegga Returns: players - - list of players {id: uuid, name: name} objects

omegga.getRoleSetup() ⇒ object

Get up-to-date role setup from RoleSetup.json

Kind: instance method of Omegga

omegga.getRoleAssignments() ⇒ object

Get up-to-date role assignments from RoleAssignment.json

Kind: instance method of Omegga

omegga.getBanList() ⇒ object

Get up-to-date ban list from BanList.json

Kind: instance method of Omegga

omegga.getNameCache() ⇒ object

Get up-to-date name cache from PlayerNameCache.json

Kind: instance method of Omegga

omegga.getPlayer(arg) ⇒ Player

find a player by name, id, controller, or state

Kind: instance method of Omegga

Param Type Description
arg String name, id, controller, or state

Omegga.getServerStatus() ⇒ Promise.<Object>

Get a server status object containing bricks, time, players, player ping, player roles, etc

Kind: instance method of Omegga Returns: Promise.<Object> - - Server Status

Omegga.getAllPlayerPositions() ⇒ Array.<Object>

get every player's position and alive states

Kind: instance method of Omegga

Omegga.getMinigames() ⇒ Array.<Object>

get all minigames and their players (and the player's teams)

Kind: instance method of Omegga

omegga.findPlayerByName(name) ⇒ Player

find a player by rough name, prioritize exact matches and get fuzzier

Kind: instance method of Omegga

Param Type Description
name String player name, fuzzy

omegga.getHostId() ⇒ String

get the host's ID

Kind: instance method of Omegga Returns: String - - Host Id

omegga.clearBricks(target, quiet)

clear a user's bricks (by uuid, name, controller, or player object)

Kind: instance method of Omegga

Param Type Default Description
target String | Object player or player identifier
quiet Boolean false quietly clear bricks

omegga.clearAllBricks(quiet)

Clear all bricks on the server

Kind: instance method of Omegga

Param Type Default Description
quiet Boolean false quietly clear bricks

omegga.saveBricks(name)

Save bricks under a name

Kind: instance method of Omegga

Param Type Description
name String save file name

omegga.loadBricks(name)

Load bricks on the server

Kind: instance method of Omegga

Param Type Description
name String save name
Number world X offset
Number world Y offset
Number world Z offset
Boolean quiet mode

omegga.getSaves() ⇒ Array.<String>

get all saves in the save folder and child folders

Kind: instance method of Omegga

omegga.getSavePath(name) ⇒ String

Checks if a save exists and returns an absolute path

Kind: instance method of Omegga Returns: String - - Path to string

Param Type Description
name String Save filename

omegga.writeSaveData(name, data)

unsafely load save data (wrap in try/catch)

Kind: instance method of Omegga

Param Type Description
name String save file name
data SaveData BRS JS Save data

omegga.readSaveData(name) ⇒ SaveData

unsafely read save data (wrap in try/catch)

Kind: instance method of Omegga Returns: SaveData - - BRS JS Save Data

Param Type Description
name String save file name

omegga.loadSaveData(data) ⇒ Promise

load bricks from save data and resolve when game finishes loading

Kind: instance method of Omegga

Param Type Description
data SaveData BRS JS Save data
Number save load X offset
Number save load Y offset
Number save load Z offset
Boolean quiet mode

omegga.getSaveData() ⇒ Promise.<SaveData>

get current bricks as save data

Kind: instance method of Omegga Returns: Promise.<SaveData> - - BRS JS Save Data

Omegga.log(...args)

send a console log to the readline terminal or stdout

Kind: static method of Omegga

Param Type Description
...args args things to print out

Omegga.error(...args)

send a console error to the readline terminal or stderr

Kind: static method of Omegga

Param Type Description
...args args things to print out

Omegga.warn(...args)

send a console warn to the readline terminal or stdout

Kind: static method of Omegga

Param Type Description
...args args things to print out

Omegga.setTerminal(...term)

send a console log to the readline terminal or console

Kind: static method of Omegga

Param Type Description
...term args things to print out

Player

Kind: global class

new Player(omegga, name, id, controller, state)

players are not to be constructed

Param Type Description
omegga Omegga Omegga Instance
name String Player Name
id String Player Id
controller String Player Controller
state String Player State

player.clone() ⇒ Player

Clone a player

Kind: instance method of Player

player.raw() ⇒ Array.<String>

Get raw player info (to feed into a constructor)

Kind: instance method of Player

player.isHost() ⇒ Boolean

true if the player is the host

Kind: instance method of Player

player.clearBricks(quiet)

clear this player's bricks

Kind: instance method of Player

Param Type Default Description
quiet Boolean false quiet mode

player.getRoles() ⇒ Array.<String>

get a player's roles, if any

Kind: instance method of Player

player.getPermissions() ⇒ Object

get a player's permissions in a map like {"Bricks.ClearOwn": true, ...}

Kind: instance method of Player Returns: Object - - permissions map

player.getNameColor() ⇒ String

get player's name color

Kind: instance method of Player Returns: String - - 6 character hex string

player.getPosition() ⇒ Promise.<List.<Number>>

get player's position

Kind: instance method of Player Returns: Promise.<List.<Number>> - - [x, y, z] coordinates

Player.getRoles(omegga, id) ⇒ Array.<String>

get a player's roles, if any

Kind: static method of Player Returns: Array.<String> - - list of roles

Param Type Description
omegga Omegga omegga instance
id String player uuid

Player.getPermissions(omegga, id) ⇒ Object

get a player's permissions in a map like {"Bricks.ClearOwn": true, ...}

Kind: static method of Player Returns: Object - - permissions map

Param Type Description
omegga Omegga Omegga instance
id String player uuid
Clone this wiki locally