From 3e5d0499b298e242954ad43d3ae27adc7960f893 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 12 Sep 2019 20:46:21 +0200 Subject: [PATCH] Disable TechHider on Public-Events --- src/de/steamwar/fightsystem/utils/TechHider.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/de/steamwar/fightsystem/utils/TechHider.java b/src/de/steamwar/fightsystem/utils/TechHider.java index 42adf1c..09b096b 100644 --- a/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/src/de/steamwar/fightsystem/utils/TechHider.java @@ -26,6 +26,7 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import java.util.ArrayList; +import java.util.Collections; import java.util.List; public class TechHider { @@ -49,6 +50,9 @@ public class TechHider { private static Material obfuscateMaterial; public static void init(){ + if(disabled()) + return; + arenaMinX = posToChunk(Config.ArenaMinX); arenaMinZ = posToChunk(Config.ArenaMinZ); blueMinX = posToChunk(Config.TeamBlueCornerX); @@ -280,6 +284,8 @@ public class TechHider { } public static List> prepareChunkReload(Player p){ + if(disabled()) + return Collections.emptyList(); List> chunksToReload = new ArrayList<>(); for(int x = arenaMinX; x <= arenaMaxX; x++) for(int z = arenaMinZ; z <= arenaMaxZ; z++) @@ -289,6 +295,8 @@ public class TechHider { } public static void reloadChunks(Player p, List> chunksToReload){ + if(disabled()) + return; Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { for(Pair chunk : chunksToReload){ if(bypass(p, chunk.getKey(), chunk.getValue())) @@ -297,6 +305,10 @@ public class TechHider { }, 40); } + private static boolean disabled(){ + return Config.event() && Config.OnlyPublicSchematics; + } + private static int posToChunk(int c){ int chunk = c / 16; if(c<0)