Player Component
The ECS component containing player-specific game state. Access through the entity store when on the world thread.
Package: com.hypixel.hytale.server.core.entity.entities.Player
Key Properties
Section titled “Key Properties”| Method | Return Type | Description |
|---|---|---|
getGameMode() | GameMode | Current game mode (Adventure or Creative) |
getDisplayName() | String | Player’s username (via PlayerRef) |
getPlayerConfigData() | PlayerConfigData | Engine-managed player data (world, recipes, respawn points) |
getInventory() | Inventory | Player’s inventory |
getViewRadius() | int | Effective view radius in chunks |
getClientViewRadius() | int | Client’s requested view radius |
getWorld() | World | Current world (nullable) |
isFirstSpawn() | boolean | True if player has never been in this world |
hasSpawnProtection() | boolean | True if player has post-spawn invulnerability (see Respawn) |
Managers
Section titled “Managers”| Method | Return Type | Description |
|---|---|---|
getWindowManager() | WindowManager | UI windows (containers, dialogs) |
getPageManager() | PageManager | Custom UI pages |
getHudManager() | HudManager | HUD elements |
getHotbarManager() | HotbarManager | Hotbar state |
getWorldMapTracker() | WorldMapTracker | Compass/map tracking |
See UI System for details on PageManager, WindowManager, and HudManager.
Game Mode
Section titled “Game Mode”// get current game modeGameMode mode = player.getGameMode();
// set game mode (fires ChangeGameModeEvent)Player.setGameMode(ref, GameMode.Creative, componentAccessor);
// initialize game mode on first joinPlayer.initGameMode(ref, componentAccessor);Available Game Modes
Section titled “Available Game Modes”| Mode | Description |
|---|---|
GameMode.Adventure | Default gameplay mode |
GameMode.Creative | Flight enabled, invulnerability granted |
Getting the Component Type
Section titled “Getting the Component Type”ComponentType<EntityStore, Player> type = Player.getComponentType();Accessing the Component
Section titled “Accessing the Component”// from a command or event handlerPlayer player = store.getComponent(ref, Player.getComponentType());
// from a holder (e.g., PlayerConnectEvent)Player player = holder.getComponent(Player.getComponentType());