From 5d5884ca1b9db97ac2c3719d822ea0291d7b09e9 Mon Sep 17 00:00:00 2001 From: Yaruma3341 Date: Wed, 17 Jul 2019 18:43:21 +0200 Subject: [PATCH] bugfixes Signed-off-by: Yaruma3341 --- .../yaruma/fightsystem/listener/PlayerQuitListener.java | 8 ++++++-- .../yaruma/fightsystem/utils/scoreboard/Scoreboard.java | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/me/yaruma/fightsystem/listener/PlayerQuitListener.java b/src/me/yaruma/fightsystem/listener/PlayerQuitListener.java index d612eaf..00eae77 100644 --- a/src/me/yaruma/fightsystem/listener/PlayerQuitListener.java +++ b/src/me/yaruma/fightsystem/listener/PlayerQuitListener.java @@ -2,6 +2,7 @@ package me.yaruma.fightsystem.listener; import me.yaruma.fightsystem.FightSystem; import me.yaruma.fightsystem.fight.Fight; +import me.yaruma.fightsystem.fight.FightPlayer; import me.yaruma.fightsystem.fight.FightState; import me.yaruma.fightsystem.fight.FightTeam; import org.bukkit.Bukkit; @@ -26,8 +27,11 @@ public class PlayerQuitListener implements Listener { if(fightState == FightState.SETUP){ fightTeam.removePlayer(player); }else if(fightState == FightState.PRE_RUNNING || fightState == FightState.RUNNING){ - fightTeam.getFightPlayer(player).setOut(true); - Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat den Kampf verlassen!"); + FightPlayer fightPlayer = fightTeam.getFightPlayer(player); + if(!fightPlayer.isOut()) { + fightTeam.getFightPlayer(player).setOut(true); + Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat den Kampf verlassen!"); + } } } } \ No newline at end of file diff --git a/src/me/yaruma/fightsystem/utils/scoreboard/Scoreboard.java b/src/me/yaruma/fightsystem/utils/scoreboard/Scoreboard.java index 8d80145..94b0d5f 100644 --- a/src/me/yaruma/fightsystem/utils/scoreboard/Scoreboard.java +++ b/src/me/yaruma/fightsystem/utils/scoreboard/Scoreboard.java @@ -39,7 +39,8 @@ public class Scoreboard { objective.setDisplayName(fightTeam.getName()); for (FightPlayer fp : fightTeam.getPlayers()) { - objective.getScore(fightTeam.getPrefix() + fp.getPlayer().getName()).setScore((int) fp.getPlayer().getHealth()); + if(!fp.isOut()) + objective.getScore(fightTeam.getPrefix() + fp.getPlayer().getName()).setScore((int) fp.getPlayer().getHealth()); } index++;