Skip to content

$this->bga->userPreferences

Read a player’s preferences configured in gamepreferences.json. Preferences customize the interface for an individual player.

API

get(int $playerId, int $prefId): ?int

Return the player’s cached preference value, or null if unset. The player argument is an ID; $prefId is the ID in the configuration file.

$colorblindMode = $this->bga->userPreferences->get($playerId, 100) ?? 0;

The framework maintains the cache when players change their preferences or open a running turn-based table. Games should use the front-end preferences API to change preferences and respond to interface changes.