Server

API reference for Server in @erlcjs/core.

Represents a single ER:LC game server managed by a Client. Holds the server's own managers, caches, polling loop, and webhook routing.

Signature:

declare class Server

#Constructors

Constructor

Modifiers

Description

(constructor)(client, key)

Creates an instance of Server.

#Properties

Property

Modifiers

Type

Description

authorizationLink

readonly

string

Creates an authorization link for this server to allow post requests.

bans

BanManager

Manager for fetching and caching the server's ban list.

client

readonly

Client

The Client that manages this server.

commandLogs

CommandLogManager

Manager for command execution log events.

commands

CommandManager

Manager for player caching, joining, and management actions.

emergencyCalls

EmergencyCallManager

Manager for active emergency calls.

hasPolledOnce

readonly

boolean

Whether the first poll attempt has completed.

hasQueue

readonly

boolean

Returns a boolean whether the server has a queue.

id

readonly

string

The ER:LC server ID, parsed from the server API key.

info?

ServerInfo

(Optional) The current server information snapshot, populated after the first successful poll.

inGameCommands

readonly

Collection<string, InGameCommand>

A collection of in-game custom commands registered for this server only.

isFull

readonly

boolean

Returns a boolean whether the server is currently full.

isPolling

readonly

boolean

Whether this server is currently being polled.

joinLogs

JoinLogManager

Manager for join and leave logs.

key

readonly

string

The ER:LC Server API key.

killLogs

KillLogManager

Manager for kill logs.

modCalls

ModCallManager

Manager for moderator call logs.

offline

boolean

Whether the server is currently offline (unreachable via the API).

players

PlayerManager

Manager for fetching and caching general server configuration.

rest

readonly

Pick<RestManager, 'request'>

REST adapter bound to this server's API key.

staff

StaffManager

Manager for staff members.

vehicles

VehicleManager

Manager for spawned vehicles cache and events.

#Methods

Method

Modifiers

Description

clearCaches()

Clears all volatile caches for this server. Called automatically when the server goes offline.

destroy()

Cleans up the server, stopping polling and clearing all caches.

fetch()

Fetches the latest server data and applies it to the caches and info snapshot.

registerCommand(cmd)

Registers an in-game custom command scoped to this server.

request(method, endpoint, body)

Sends a request to the ER:LC API on behalf of this server.

startPolling(pollRateMs)

Starts polling the ER:LC API with a set poll rate, restarts the poll if one already exists.

stopPolling()

Stops polling the ER:LC API.

unregisterCommand(commandName)

Unregisters an in-game custom command scoped to this server.

waitFor(event, timeoutMs)

Waits for a specific client event to be emitted for this server.