PlayerManager

API reference for PlayerManager in @erlcjs/core.

Manager responsible for fetching, caching, and updating Player structures.

Signature:

declare class PlayerManager

#Constructors

Constructor

Modifiers

Description

(constructor)(server)

Creates an instance of PlayerManager.

#Properties

Property

Modifiers

Type

Description

cache

Collection<number, Player>

Collection cache of online Players, keyed by their UserId.

onlineStaff

readonly

Player[]

Gets a list of all players with a permission level other than 'Normal'.

wanted

readonly

Player[]

Gets a list of all players with a wanted level greater than 0.

#Methods

Method

Modifiers

Description

clear()

Clears the player cache and username mappings.

fetchAll()

Fetches all active players currently in the game server. Updates the player cache.

getIdFromName(name)

Retrieves a player's UserId from their Roblox username, resolving from cache.

unadmin(userId)

Unadmins a player from their userId.

unban(userId)

Unbans a player from their userId.

unhelper(userId)

Unhelpers a player from their userId.

unmod(userId)

Unmods a player from their userId.

updateCache(rawPlayers)

Re-synchronizes the cache with the raw player list from the API. Emits playerJoin, playerLeave, and playerUpdate events.