Player Data
Data class representing all persistent player information in the MMO system.
This class serves as the central data structure for storing and managing all player-related information that needs to persist across server restarts. It implements a dirty tracking system to optimize database operations by only saving data when changes have been made.
The class manages several categories of player data:
Core Stats: Level, XP, gold, gems
Identity: UUID and username
Inventory: Main inventory and armor contents
Flags: Persistent key-value pairs for plugin communication
Preferences: Plugin-specific settings and data storage
Dirty Tracking System: The class automatically tracks when data has been modified through the isDirty flag. All property setters update this flag when values change, allowing the persistence system to perform efficient saves by only writing modified data to the database.
Thread Safety: This class is NOT thread-safe. Access should be synchronized externally or limited to single-threaded contexts (typically the main server thread).
Parameters
The unique identifier for this player (immutable)
The player's current display name (mutable)
The player's current character level
The player's total experience points
The player's current gold currency amount
The player's current gem currency amount
Constructors
Properties
Array containing the player's equipped armor contents.
Array containing the player's main inventory contents.
Map containing persistent player flags for inter-plugin communication.
Nested map containing plugin-specific player preferences and data.
Functions
Retrieves a player flag value by key.
Removes a player flag from the persistent storage.
Removes a plugin-specific preference.
Sets a player flag to a specific value.
Sets a plugin-specific preference value.