mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-01-07 08:58:23 +01:00
Guard against exceptions when setting scoreboards for disconnecting players.
Turns out that a player who disconnects while in the arena is actually still online if you ask the Player object. The setScoreboard() javadoc specifically says it throws an IllegalStateException in that case, so we can just catch and swallow it. It's unclear what the state of the player's scoreboard is when they rejoin the server, but a borken scoreboard is better than a rogue exception.
This commit is contained in:
parent
99f57b7128
commit
5d2881383f
@ -44,7 +44,11 @@ public class ScoreboardManager {
|
||||
* @param player a player
|
||||
*/
|
||||
void removePlayer(Player player) {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
|
||||
try {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
|
||||
} catch (IllegalStateException e) {
|
||||
// Happens if the player is logging out, just swallow it
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user