SteamWar/FightSystem
Archiviert
13
1

Disable TechHider on Public-Events

Dieser Commit ist enthalten in:
Lixfel 2019-09-12 20:46:21 +02:00
Ursprung 10906d93d7
Commit 3e5d0499b2

Datei anzeigen

@ -26,6 +26,7 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class TechHider { public class TechHider {
@ -49,6 +50,9 @@ public class TechHider {
private static Material obfuscateMaterial; private static Material obfuscateMaterial;
public static void init(){ public static void init(){
if(disabled())
return;
arenaMinX = posToChunk(Config.ArenaMinX); arenaMinX = posToChunk(Config.ArenaMinX);
arenaMinZ = posToChunk(Config.ArenaMinZ); arenaMinZ = posToChunk(Config.ArenaMinZ);
blueMinX = posToChunk(Config.TeamBlueCornerX); blueMinX = posToChunk(Config.TeamBlueCornerX);
@ -280,6 +284,8 @@ public class TechHider {
} }
public static List<Pair<Integer, Integer>> prepareChunkReload(Player p){ public static List<Pair<Integer, Integer>> prepareChunkReload(Player p){
if(disabled())
return Collections.emptyList();
List<Pair<Integer, Integer>> chunksToReload = new ArrayList<>(); List<Pair<Integer, Integer>> chunksToReload = new ArrayList<>();
for(int x = arenaMinX; x <= arenaMaxX; x++) for(int x = arenaMinX; x <= arenaMaxX; x++)
for(int z = arenaMinZ; z <= arenaMaxZ; z++) for(int z = arenaMinZ; z <= arenaMaxZ; z++)
@ -289,6 +295,8 @@ public class TechHider {
} }
public static void reloadChunks(Player p, List<Pair<Integer, Integer>> chunksToReload){ public static void reloadChunks(Player p, List<Pair<Integer, Integer>> chunksToReload){
if(disabled())
return;
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
for(Pair<Integer, Integer> chunk : chunksToReload){ for(Pair<Integer, Integer> chunk : chunksToReload){
if(bypass(p, chunk.getKey(), chunk.getValue())) if(bypass(p, chunk.getKey(), chunk.getValue()))
@ -297,6 +305,10 @@ public class TechHider {
}, 40); }, 40);
} }
private static boolean disabled(){
return Config.event() && Config.OnlyPublicSchematics;
}
private static int posToChunk(int c){ private static int posToChunk(int c){
int chunk = c / 16; int chunk = c / 16;
if(c<0) if(c<0)