diff --git a/src/main/java/net/tiagofar78/prisonescape/game/PEGame.java b/src/main/java/net/tiagofar78/prisonescape/game/PEGame.java index 34d242f..fa6d574 100644 --- a/src/main/java/net/tiagofar78/prisonescape/game/PEGame.java +++ b/src/main/java/net/tiagofar78/prisonescape/game/PEGame.java @@ -268,7 +268,7 @@ private void addPlayerToStartedGame(PEPlayer player, Kit kit, Location location, public void removePlayerFromGame(PEPlayer player) { player.removeScoreboard(); - _bossBar.removePlayer(player.getBukkitPlayer()); + player.removeBossBar(_bossBar); teleportToLeavingLocation(player); } diff --git a/src/main/java/net/tiagofar78/prisonescape/game/PEPlayer.java b/src/main/java/net/tiagofar78/prisonescape/game/PEPlayer.java index 05830e2..6145ab0 100644 --- a/src/main/java/net/tiagofar78/prisonescape/game/PEPlayer.java +++ b/src/main/java/net/tiagofar78/prisonescape/game/PEPlayer.java @@ -513,6 +513,13 @@ public void setBossBar(BossBar bossBar) { } } + public void removeBossBar(BossBar bossBar) { + Player player = getBukkitPlayer(); + if (player != null) { + bossBar.removePlayer(player); + } + } + public void setEffect(PotionEffectType effect, int seconds, int level) { Player player = Bukkit.getPlayer(getName()); if (player == null || !player.isOnline()) {