From b6ad157e38c151b7d4c216d446e49f0776511756 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 12 Apr 2021 18:17:20 +0200 Subject: [PATCH] Fix techhider on team leave Signed-off-by: Lixfel --- .../steamwar/fightsystem/countdown/EnternCountdown.java | 4 ++-- .../src/de/steamwar/fightsystem/fight/FightTeam.java | 8 ++++---- .../src/de/steamwar/fightsystem/utils/TechHider.java | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/EnternCountdown.java b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/EnternCountdown.java index 236c85f..925bf69 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/EnternCountdown.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/EnternCountdown.java @@ -48,7 +48,7 @@ public class EnternCountdown extends Countdown { @Override public void countdownFinished() { fightPlayer.getPlayer().sendMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!"); - TechHider.reloadChunks(fightPlayer.getPlayer(), chunkPos); + TechHider.reloadChunks(fightPlayer.getPlayer(), chunkPos, false); } @Override @@ -70,7 +70,7 @@ public class EnternCountdown extends Countdown { BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a1 §rSekunde " + countdownCounting())); - chunkPos = TechHider.prepareChunkReload(player); + chunkPos = TechHider.prepareChunkReload(player, false); break; case 0: player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 2.0F); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java index 483738d..9d3a9fb 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -177,7 +177,7 @@ public class FightTeam implements IFightTeam{ } public void addMember(Player player) { - final List chunksToReload = TechHider.prepareChunkReload(player); + final List chunksToReload = TechHider.prepareChunkReload(player, false); FightPlayer fightPlayer = new FightPlayer(player, this); players.put(player, fightPlayer); invited.remove(player); @@ -195,7 +195,7 @@ public class FightTeam implements IFightTeam{ if(!Config.test()) Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), prefix + player.getName()).send(player), 5); RecordSystem.playerJoins(player); - TechHider.reloadChunks(player, chunksToReload); + TechHider.reloadChunks(player, chunksToReload, false); if(isLeaderless()) setLeader(fightPlayer); @@ -204,7 +204,7 @@ public class FightTeam implements IFightTeam{ public void removePlayer(Player player) { FightPlayer fightPlayer = getFightPlayer(player); - List chunksToReload = TechHider.prepareChunkReload(player); + List chunksToReload = TechHider.prepareChunkReload(player, true); players.remove(player); team.removeEntry(player.getName()); @@ -219,7 +219,7 @@ public class FightTeam implements IFightTeam{ if(player.isOnline()){ if(!ArenaMode.Test.contains(Config.mode)) new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player); - TechHider.reloadChunks(player, chunksToReload); + TechHider.reloadChunks(player, chunksToReload, true); } } diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java index 08306d3..3a3308e 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java @@ -263,23 +263,23 @@ public class TechHider extends StateDependent { } }; - public static List prepareChunkReload(Player p){ + public static List prepareChunkReload(Player p, boolean hide){ if(!enabled) return Collections.emptyList(); List chunksToReload = new ArrayList<>(); Config.ArenaRegion.forEachChunk((x, z) -> { - if(!bypass(p, x, z)) + if(bypass(p, x, z) == hide) chunksToReload.add(new ChunkPos(x, z)); }); return chunksToReload; } - public static void reloadChunks(Player p, List chunksToReload){ + public static void reloadChunks(Player p, List chunksToReload, boolean hide){ if(!enabled) return; Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { for(ChunkPos chunk : chunksToReload){ - if(bypass(p, chunk.x(), chunk.z())) + if(bypass(p, chunk.x(), chunk.z()) != hide) ChunkListener.sendChunk(p, chunk.x(), chunk.z()); } }, 40);