Skip to main content

EntityManager

The manager that keeps track of all entities.

warning

You should never have to construct this class yourself.

import { client } from 'beapi-core';

client.entities...;

Constructor​

new EntityManager(client);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
clientClient❌nullConstructed Client instance.

Methods​

newRuntimeId​

returns a new runtime id.

newRuntimeId();

Returns​

number


create​

Creates an entity instance.

create(entity);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
entityIEntity❌undefinedEntity to create.

Returns​

Entity


add​

Adds an entity to the manager.

add(entity);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
entityEntity❌undefinedEntity to add.

Returns​

void


remove​

Removes an entity from the manager.

remove(entity);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
entityentity❌undefinedEntity to remove.

Returns​

void


removeByRuntimeId​

Removes an entity from the manager by its runtime id.

removeByRuntimeId(id);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber❌undefinedEntity id to remove.

Returns​

void


getAll​

Returns all entities as a map.

getAll();

Returns​

Map<number, Entity>


getByNameTag​

Returns an entity by its nametag.

getByNameTag(name);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestring❌undefinedEntity to get.

Returns​

Entity | undefined


getByRuntimeId​

Returns an entity by its runtime id.

getByRuntimeId(id);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idnumber❌undefinedEntity to get.

Returns​

Entity | undefined


getByIEntity​

Returns an entity by its IEntity.

getByIEntity(entity);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
entityIEntity❌undefinedEntity to get.

Returns​

Entity | undefined


getLastest​

Gets most recently added entity (supposed to be latest but this got into production so new word "lastest").

getLastest();

Returns​

Entity | undefined