From d04680e4b88c5698f8a9ed13751d88dd3949431f Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sat, 22 Jun 2019 17:11:10 +0200 Subject: [PATCH] Reformatting for bugfixing --- .../yaruma/fightsystem/utils/TechHider.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/me/yaruma/fightsystem/utils/TechHider.java b/src/me/yaruma/fightsystem/utils/TechHider.java index 1c27ec5..3793d55 100644 --- a/src/me/yaruma/fightsystem/utils/TechHider.java +++ b/src/me/yaruma/fightsystem/utils/TechHider.java @@ -30,6 +30,8 @@ import java.util.List; public class TechHider { + private TechHider(){} + private static int arenaMinX; private static int arenaMaxX; private static int arenaMinZ; @@ -67,6 +69,10 @@ public class TechHider { //noinspection deprecation obfuscateMaterial = Material.getMaterial(Config.ObfuscateWith); + System.out.println("Arena: " + arenaMinX + "->" + arenaMaxX + " " + arenaMinZ + "->" + arenaMaxZ); + System.out.println("Blue: " + blueMinX + "->" + blueMaxX + " " + blueMinZ + "->" + blueMaxZ); + System.out.println("Red: " + redMinX + "->" + redMaxX + " " + redMinZ + "->" + redMaxZ); + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) { @Override public void onPacketSending(PacketEvent e) { @@ -167,7 +173,6 @@ public class TechHider { } }); ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) { - @SuppressWarnings("deprecation") @Override public void onPacketSending(PacketEvent e) { PacketContainer packet = e.getPacket(); @@ -186,7 +191,6 @@ public class TechHider { } }); ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) { - @SuppressWarnings("deprecation") @Override public void onPacketSending(PacketEvent e) { PacketContainer packet = e.getPacket(); @@ -248,7 +252,12 @@ public class TechHider { } private static boolean bypass(Player p, int chunkX, int chunkZ){ - if( ! (arenaMinX <= chunkX && chunkX <= arenaMaxX && arenaMinZ <= chunkZ && chunkZ <= arenaMaxZ)){ + if( + arenaMinX > chunkX || + chunkX > arenaMaxX || + arenaMinZ > chunkZ || + chunkZ > arenaMaxZ + ){ //Außerhalb der Arena return true; } @@ -257,9 +266,17 @@ public class TechHider { if(ft == null){ return false; }else if(ft.equals(Fight.getBlueTeam())){ - return FightSystem.isEntern() || !(redMinX <= chunkX && chunkX <= redMaxX && redMinZ <= chunkZ && chunkZ <= redMaxZ); + return FightSystem.isEntern() || + redMinX > chunkX || + chunkX > redMaxX || + redMinZ > chunkZ || + chunkZ > redMaxZ; }else{ - return FightSystem.isEntern() || !(blueMinX <= chunkX && chunkX <= blueMaxX && blueMinZ <= chunkZ && chunkZ <= blueMaxZ); + return FightSystem.isEntern() || + blueMinX > chunkX || + chunkX > blueMaxX || + blueMinZ > chunkZ || + chunkZ > blueMaxZ; } } @@ -276,7 +293,7 @@ public class TechHider { Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { for(Pair chunk : chunksToReload) ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunk.getKey(), chunk.getValue())).getHandle(), 65535)); - }, 20); + }, 40); } private static int readVarInt(byte[] array, int startPos) {