Home > server > PlayerManager
Manages all connected players in a game server.
Signature:
export default class PlayerManager The PlayerManager is created internally as a global singleton accessible with the static property PlayerManager.instance.
This class emits global events with payloads listed under PlayerManagerEventPayloads
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the PlayerManager class.
import { PlayerManager } from 'hytopia';
const playerManager = PlayerManager.instance;
const connectedPlayers = playerManager.getConnectedPlayers();|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
The global PlayerManager instance as a singleton. | ||
|
|
number |
The number of players currently connected to the server. |
|
Method |
Modifiers |
Description |
|---|---|---|
|
Get a connected player by their username (case insensitive). | ||
|
Get all connected players. | ||
|
Get all connected players in a specific world. |