Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Player API

Omegga.getPlayer(target) returns an OmeggaPlayer. The same methods are available as statics on the Player global when all you have is a uuid.

OmeggaPlayer

PropertyTypeDescription
namestringplayer name
displayNamestringplayer display name
idstringplayer uuid
controllerstringplayer controller id
statestringplayer state id

getOmegga

getOmegga(): OmeggaLike

Returns omegga

clone

clone(): OmeggaPlayer

Clone a player

raw

raw(): [string, string, string, string, string]

Get raw player info (to feed into a constructor)

isHost

isHost(): boolean

True if the player is the host

clearBricks

clearBricks(quiet?: boolean): void

Clear player’s bricks

ParamTypeDescription
quietbooleanclear bricks quietly

getRoles

getRoles(): readonly string[]

Get player’s roles, if any

getPermissions

getPermissions(): Record<string, boolean>

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

Returns permissions map

getNameColor

getNameColor(): string

Get player’s name color

Returns 6 character hex string

getPawn

getPawn(): Promise<string | null>

Get the player’s pawn; null when the player has no pawn

Returns pawn

getPosition

getPosition(): Promise<[number, number, number] | null>

Get player’s position; null when the player has no pawn

Returns [x, y, z] coordinates

getGhostBrick

getGhostBrick(): Promise< | { targetGrid: string; location: number[]; orientation: string; } | undefined >

Gets a user’s ghost brick info (by uuid, name, controller, or player object)

Returns ghost brick data

getPaint

getPaint(): Promise< | { materialIndex: string; materialAlpha: string; material: string; color: number[]; } | undefined >

gets a user’s paint tool properties

isCrouched

isCrouched(pawn?: string): Promise<boolean>

gets whether or not the player is crouching

isDead

isDead(pawn?: string): Promise<boolean>

gets whether or not the player is dead

getTemplateBounds

getTemplateBounds(): Promise<BrickBounds | undefined>

Gets the bounds of the template in the user’s clipboard (bounds of original selection box)

Returns template bounds

getTemplateBoundsData

getTemplateBoundsData(): Promise<ReadSaveObject | undefined>

Get bricks inside template bounds

Returns BRS JS Save Data

loadDataAtGhostBrick

loadDataAtGhostBrick(saveData: WriteSaveObject, options?: { rotate?: boolean; offX?: number; offY?: number; offZ?: number; quiet?: boolean; }): Promise<void>

Load bricks at ghost brick location

ParamTypeDescription
saveDataWriteSaveObjectsave data to load
options{ rotate?: boolean; offX?: number; offY?: number; offZ?: number; quiet?: boolean; }

loadBricks

loadBricks(saveName: string): void

Load bricks on this player’s clipboard

ParamTypeDescription
saveNamestringSave to load

loadSaveData

loadSaveData(saveData: WriteSaveObject, options?: { rotate?: boolean; offX?: number; offY?: number; offZ?: number; quiet?: boolean; }): Promise<void>

Load bricks on this player’s clipboard passing save data

ParamTypeDescription
saveDataWriteSaveObjectsave data to load
options{ rotate?: boolean; offX?: number; offY?: number; offZ?: number; quiet?: boolean; }

kill

kill(): void

Kills this player

damage

damage(amount: number): void

Damages a player

ParamTypeDescription
amountnumberAmount to damage

heal

heal(amount: number): void

Heal this player

ParamTypeDescription
amountnumberto heal

giveItem

giveItem(item: WeaponClass): void

Gives a player an item

ParamTypeDescription
itemWeaponClassItem name (Weapon_Bow)

takeItem

takeItem(item: WeaponClass): void

Removes an item from a player’s inventory

ParamTypeDescription
itemWeaponClassItem name (Weapon_Bow)

setTeam

setTeam(teamIndex: number): void

Changes a player’s team

ParamTypeDescription
teamIndexnumberTeam index

setMinigame

setMinigame(index: number): void

Changes a player’s minigame

ParamTypeDescription
indexnumberMinigame index

setScore

setScore(minigameIndex: number, score: number): void

Changes a player’s score

ParamTypeDescription
minigameIndexnumberminigame index
scorenumberScore

getScore

getScore(minigameIndex: number): Promise<number>

Fetch a player’s score

ParamTypeDescription
minigameIndexnumberminigame index

setLeaderboard

setLeaderboard(key: string, value: number): void

Set leaderboard value

ParamTypeDescription
keystringleaderboard key (Score, Kills, Deaths, CorrectGuesses)
valuenumberleaderboard value

getLeaderboard

getLeaderboard(key: string): Promise<number | null>

Get leaderboard value

ParamTypeDescription
keystringleaderboard key (Score, Kills, Deaths, CorrectGuesses)

Returns leaderboard value

Declared in src/plugin.ts.

StaticPlayer

getRoles

getRoles(omegga: OmeggaLike, id: string): readonly string[]

get a player’s roles, if any

ParamTypeDescription
omeggaOmeggaLikeomegga instance
idstringplayer uuid

Returns list of roles

getPermissions

getPermissions(omegga: OmeggaLike, id: string): Record<string, boolean>

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

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
idstringplayer uuid

Returns permissions map

kill

kill(omegga: OmeggaLike, target: string | OmeggaPlayer): void

Kills a player

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id

damage

damage(omegga: OmeggaLike, target: string | OmeggaPlayer, amount: number): void

Damages a player

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
amountnumberDamage amount

heal

heal(omegga: OmeggaLike, target: string | OmeggaPlayer, amount: number): void

Heal a player

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
amountnumberHeal amount

giveItem

giveItem(omegga: OmeggaLike, target: string | OmeggaPlayer, item: WeaponClass): void

Gives a player an item

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
itemWeaponClassItem name (Weapon_Bow)

takeItem

takeItem(omegga: OmeggaLike, target: string | OmeggaPlayer, item: WeaponClass): void

Removes an item from a player’s inventory

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
itemWeaponClassItem name (Weapon_Bow)

setTeam

setTeam(omegga: OmeggaLike, target: string | OmeggaPlayer, teamIndex: number): void

Changes a player’s team

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
teamIndexnumberTeam name? index?

setMinigame

setMinigame(omegga: OmeggaLike, target: string | OmeggaPlayer, index: number): void

Changes a player’s minigame

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
indexnumberMinigame index

setScore

setScore(omegga: OmeggaLike, target: string | OmeggaPlayer, minigameIndex: number, score: number): void

Changes a player’s score

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
minigameIndexnumberminigame index
scorenumberScore

getScore

getScore(omegga: OmeggaLike, target: string | OmeggaPlayer, minigameIndex: number): Promise<number>

Fetches a player’s score

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
minigameIndexnumberminigame index

setLeaderboard

setLeaderboard(omegga: OmeggaLike, target: string | OmeggaPlayer, key: string, value: number): void

Set leaderboard value

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
keystringleaderboard key (Score, Kills, Deaths, CorrectGuesses)
valuenumberleaderboard value

getLeaderboard

getLeaderboard(omegga: OmeggaLike, target: string | OmeggaPlayer, key: string): Promise<number | null>

Get leaderboard value

ParamTypeDescription
omeggaOmeggaLikeOmegga instance
targetstring | OmeggaPlayerPlayer or player name/id
keystringleaderboard key (Score, Kills, Deaths, CorrectGuesses)

Returns leaderboard value

Declared in src/plugin.ts.