The heartbeat used for announcing the server to a server list. By default, I load BaseHeartbeat asynchronously if serverConfiguration.postToMainServer is true.
The currently loaded levels. Indexed by BaseLevel.name.
Use BaseLevel.loadIntoUniverse or BaseLevel.teleportPlayer to load levels into this map.
A classicborne-server-protocol Server instance.
StaticdefaultStaticheartbeatThe BaseHeartbeat class used for announcing my presence. This is a promise as the constructor asynchronously imports the module for the class and assigns it to BaseUniverse.heartbeat.
StaticplayerThe BasePlayer class to instantiate when clients connect to the server.
Registers the player into the universe, assigning it a network identifier and emitting a playerAdded event.
The player to register.
Optionalevent: "playerAdded" | "playerRemoved"Unregisters the player from the universe, emitting a playerRemoved event. This is called on player disconnect or by BasePlayer.client.disconnect.
I'm a Minecraft Classic game server, responsible for managing the server lifecycle, connected players and loaded levels.
I coordinate the following core objects:
Events
I'm an event emitter. I emit the following events:
playerAdded(player): When a player joins.playerRemove(player): When a player disconnects.Subclassing
Like other object in the classicborne ecosystem, universes are usually subclasses of me.
Dependency injection
My class-sided fields are defaulted to base class implementations. For example, I initialize new instances of a Player using my playerClass static field. Such class-sided members are intended to be overwritten by my subclasses. This is known as "dependency injection".
I provide the following class fields for dependency injection:
Example: Creating a custom universe by extending BaseUniverse.