Skip to main content

PlayerManager

The manager that keeps track of all players.

warning

You should never have to construct this class yourself.

import { client } from 'beapi-core';

client.players...;

Constructor

new PlayerManager(client);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
clientClientnullConstructed Client instance.

Methods

create

Creates a Player instance.

create(player);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
playerIPlayerundefinedPlayer to create.

Returns

Player


add

Adds a player to the manager.

add(player);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
playerPlayerundefinedPlayer to add.

Returns

void


remove

Removes a player from the manager.

remove(player);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
playerPlayerundefinedPlayer to remove.

Returns

void


removeByName

Removes a player from the manager by their name.

removeByName(name);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestringundefinedPlayer to remove.

Returns

void


getAll

Returns all players as a map.

getAll();

Returns

Map<string, Player>


getByName

Returns a player their name.

getByName(name);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestringundefinedPlayer to get.

Returns

Player | undefined


getByNameTag

Returns a player their nameTag.

getByNameTag(name);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestringundefinedPlayer to get.

Returns

Player | undefined


getByIPlayer

Returns a player their IPlayer.

getByIPlayer(player);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
playerIPlayerundefinedPlayer to get.

Returns

Player | undefined