From e0b6c1b93141c92f131bf51bd76d82d69696f706 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 11 Feb 2024 18:55:32 +0100 Subject: [PATCH] Potential Border rejoin fix Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/fight/FightTeam.java | 11 +++++++---- .../src/de/steamwar/fightsystem/listener/Border.java | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java index 544be31..136ede0 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -201,13 +201,16 @@ public class FightTeam { schematic.reset(); Set playerSet = new HashSet<>(players.keySet()); - for(UUID uuid : playerSet){ + playerSet.removeIf(uuid -> { Player player = Bukkit.getPlayer(uuid); - if(player == null) + if(player == null || !player.isOnline()) { removePlayer(players.get(uuid).getEntity()); - } + return true; + } + + return false; + }); FightPlayer leaderBackup = leader; - playerSet.removeIf(uuid -> Bukkit.getPlayer(uuid) == null); players.clear(); leader = null; diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Border.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Border.java index 043dcf0..02c395a 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Border.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Border.java @@ -61,7 +61,7 @@ public class Border { } public void addPlayer(Player player) { - if(ghostBarriers.containsKey(player)) + if(ghostBarriers.containsKey(player) || !player.isOnline()) return; ghostBarriers.put(player, new HashSet<>());