LeaderboardManager
class LeaderboardManager
Manages all leaderboard instances and their lifecycle.
Responsible for:
- Storing active leaderboards
- Loading and saving persistent data
- Dispatching update events
Properties
| protected Leaderboard> | $leaderboards | ||
| protected Config | $leaderboardData |
Methods
Remove a leaderboard by ID and destroy its model.
Get a leaderboard by ID.
Get all registered leaderboards.
Get all leaderboards matching a specific type.
Dispatches a leaderboard update event for the specified type.
Load leaderboard data from storage.
Access the underlying leaderboard storage config.
Save all leaderboard data to storage.
Details
at line 53
__construct(TopStats $plugin)
No description
at line 62
LeaderboardManager
add(Leaderboard $leaderboard)
Add a leaderboard instance.
at line 70
LeaderboardManager
remove(int $id)
Remove a leaderboard by ID and destroy its model.
at line 85
Leaderboard|null
get(int $id)
Get a leaderboard by ID.
at line 94
array
leaderboards()
Get all registered leaderboards.
at line 104
array
getLeaderboardFromType(string $type)
Get all leaderboards matching a specific type.
at line 123
bool
dispatchLeaderboardUpdate(string $type, array $data = [])
Dispatches a leaderboard update event for the specified type.
This function retrieves all leaderboards that match the provided type, fires a {\Nicholass003\TopStats\Event\TopStatsUpdateEvent}, and updates each leaderboard unless the event is cancelled.
at line 147
void
loadData()
Load leaderboard data from storage.
at line 173
Config
getLeaderboardData()
Access the underlying leaderboard storage config.
at line 182
void
saveData()
Save all leaderboard data to storage.
Also destroys associated models before saving.