From 301a51bcd9a7357287d4ef26bf563e89d1f00660 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 11 Mar 2023 20:43:47 +0100 Subject: [PATCH] Delay Team adding Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/fight/FightTeam.java | 2 +- .../src/de/steamwar/fightsystem/listener/Permanent.java | 3 ++- .../src/de/steamwar/fightsystem/record/PacketProcessor.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java index dac4135..c870054 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -250,7 +250,7 @@ public class FightTeam { players.put(player, fightPlayer); invited.remove(player); Permanent.getSpectatorTeam().removeEntry(player.getName()); - team.addEntry(player.getName()); + Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> team.addEntry(player.getName()), 2); Fight.setPlayerGamemode(player, GameMode.SURVIVAL); player.setHealth(20); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java index 64aa91a..1ce0c82 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java @@ -28,6 +28,7 @@ import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.utils.FlatteningWrapper; import net.md_5.bungee.api.ChatMessageType; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.block.Block; @@ -87,7 +88,7 @@ public class Permanent implements Listener { if (!Config.ArenaLeaveable && !Fight.fighting(player)) { Fight.setPlayerGamemode(player, GameMode.SPECTATOR); - spectatorTeam.addEntry(player.getName()); + Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> spectatorTeam.addEntry(player.getName()), 2); player.teleport(Config.SpecSpawn); } } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java index 5d61268..893d2b3 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java @@ -236,7 +236,7 @@ public class PacketProcessor implements Listener { execSync(() -> { SteamwarUser user = SteamwarUser.get(userId); entities.put(entityId, new RPlayer(entityServer, user.getUUID(), user.getUserName(), Config.SpecSpawn)); - team.addEntry(user.getUserName()); + Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> team.addEntry(user.getUserName()), 2); }); }