new PlayerManager(client)
| Name | Type | Description |
|---|---|---|
client |
RCONClient |
Extends
Members
-
cacheMap.<string, Player>
-
-
clientRCONClient
-
Methods
-
_cache(data, isPartial){Player}
-
Resolves a player data payload into a cached Player object and returns the Player instance.
Name Type Default Description dataObject isPartialboolean false optional Returns:
Type Description Player -
inherited _validateParameter(value, name, conditions)
-
Checks if a parameter satisfies specific conditions.
Name Type Description valueany The actual value of the parameter.
namestring The name of the parameter.
conditionsObject optional Conditions to be met.
Name Type Default Description definedboolean true optional Parameter must not be null or undefined.
nonEmptyStringboolean true optional Parameter must be a non-empty string.
positiveIntegerboolean false optional Parameter must be a positive integer.
integerboolean false optional Parameter must be an integer.
booleanboolean false optional Parameter must be a boolean.
-
inherited _validateResponse(response, additionalErrors){Object}
-
Validates RCON response by checking status code.
Name Type Description responseResponseMessage additionalErrorsObject Throws:
ErrorReturns:
Type Description Object -
asyncaddAdmin(playerId, adminGroup, comment){Promise.<void>}
-
Adds a user as an admin.
Name Type Description playerIdstring adminGroupstring commentstring optional Returns:
Type Description Promise.<void> -
asyncaddVIP(playerId, comment){Promise.<void>}
-
Grants player VIP status.
Name Type Description playerIdstring The player's ID.
commentstring optional A comment to identify this player in the VIP list.
Returns:
Type Description Promise.<void> -
asyncdisbandPlatoon(team, platoon, reason){Promise.<void>}
-
Disbands a platoon.
Name Type Description teamstring | number The number of name of the team, ex: 0, or "AXIS"
platoonstring | number The name of the platoon, ex: 0 or "ABLE"
reasonstring optional Throws:
-
- If team or platoon is undefined.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asyncfetch(playerId){Promise.<Player>}
-
Fetches information for a player.
Name Type Description playerIdstring The player's ID.
Throws:
-
If the player is not found.
- Type
- Error
Returns:
Type Description Promise.<Player> -
-
asyncfetchAllPlayers(){Promise.<Array.<Player>>}
-
Fetches all players actively in the server.
Returns:
Type Description Promise.<Array.<Player>> -
asynckick(playerId, reason){Promise.<void>}
-
Kicks a player from the server.
Name Type Description playerIdstring The player ID or username.
reasonstring optional Reason to kick the player for.
Throws:
-
- If player is undefined.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asynclistAdminGroups(){Promise.<Array.<string>>}
-
Lists admin groups.
Returns:
Type Description Promise.<Array.<string>> -
asynclistAdminUsers(){Promise.<Array.<AdminUserRecord>>}
-
Lists admin users.
Returns:
Type Description Promise.<Array.<AdminUserRecord>> -
asynclistPermaBans(){Promise.<Array.<BanRecord>>}
-
Lists permanent bans on record.
Returns:
Type Description Promise.<Array.<BanRecord>> -
asynclistTempBans(){Promise.<Array.<BanRecord>>}
-
Lists temporary bans on record.
Returns:
Type Description Promise.<Array.<BanRecord>> -
asynclistVIPPlayers(){Promise.<Array.<VIPPlayer>>}
-
Retrieves the list of VIP players for this server.
Returns:
Type Description Promise.<Array.<VIPPlayer>> -
asyncmessage(playerId, message){Promise.<void>}
-
Sends a message to a player.
Name Type Description playerIdstring The player ID or username.
messagestring The message to send.
Throws:
-
- If player or message is undefined.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asyncpermaBan(playerId, reason, adminName){Promise.<void>}
-
Permanently ban a player.
Name Type Description playerIdstring reasonstring optional adminNamestring optional Throws:
-
- If playerId is undefined.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asyncpunish(playerId, reason){Promise.<void>}
-
Punishes a player.
Name Type Description playerIdstring reasonstring optional Throws:
-
- If playerId is undefined.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asyncremoveAdmin(playerId){Promise.<void>}
-
Removes this player as an admin.
Name Type Description playerIdstring Returns:
Type Description Promise.<void> -
asyncremovePermaBan(playerId){Promise.<void>}
-
Removes a player's permanent ban.
Name Type Description playerIdstring Throws:
-
- If playerId is undefined.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asyncremovePlayerFromPlatoon(playerId, reason){Promise.<void>}
-
Removes a player from their platoon.
Name Type Description playerIdstring reasonstring optional Throws:
-
- If player is commander or isn't in a platoon.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asyncremoveTempBan(playerId){Promise.<void>}
-
Removes a temporary ban.
Name Type Description playerIdstring Throws:
-
- If playerId is undefined.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asyncremoveVIP(playerId){Promise.<void>}
-
Removes a player's VIP status.
Name Type Description playerIdstring Throws:
-
- If playerId is undefined.
- Type
- Error
Returns:
Type Description Promise.<void> -
-
asyncswitchTeams(playerId, switchNow){Promise.<void>}
-
Switches a player's team.
Name Type Default Description playerIdstring switchNowboolean true optional Whether to switch this player's team immediately, as opposed to on death.
Returns:
Type Description Promise.<void> -
asynctempBan(playerId, duration, reason, adminName){Promise.<void>}
-
Temporarily ban a player from the server.
Name Type Description playerIdstring durationnumber The ban duration in hours.
reasonstring optional adminNamestring optional Throws:
-
-
- If playerId is undefined.
- Type
- Error
-
-
-
- If duration isn't a positive integer.
- Type
- Error
-
Returns:
Type Description Promise.<void> -