-
Notifications
You must be signed in to change notification settings - Fork 0
CoreScoreboardManager
Scoreboard is wonderful feature, but unfortunately is not very compatible (one plugin can easily override other plugin which is never notified so it won't take back scoreboard). CoreScoreboardManager tries to solve this.
By default, it will display stats scoreboard. At the moment it is only hydration, but every plugin can tap into it by setting
CoreScoreboardManager.setPlayerStat(player, stat name, number)
If you set number to null, it will remove (hide) entry.
If plugin wants to add its own scoreboard, it can do that by calling following command (needs to be called every time after player reconnects). Priority also acts as scoreboard ID (only one scoreboard with specific priority can be registered at any time):
CoreScoreboardManager.registerScoreboard(player, priority, scoreboard)
When player is finished with event, scoreboard can be removed by calling this:
CoreScoreboardManager.unregisterScoreboard(player, priority)
CoreScoreboardManager will take care of compatibility and make sure that scoreboard with highest priority is always displayed. Since player is usually only involved in one event, this currently mostly serves for switching between stats and event scoreboard. But still, only one scoreboard can have its own priority number so it is best if every plugin using that is written here:
0 = (Reserved) stats scoreboard 1 = Monsterhunt