From 3247ea737c9cc8092bfa23a7bc3c10b3471d9f46 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 8 Nov 2019 09:32:43 +0100 Subject: [PATCH] Synchronizing Techhider to prevent block-bug --- .../steamwar/fightsystem/utils/TechHider.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/de/steamwar/fightsystem/utils/TechHider.java b/src/de/steamwar/fightsystem/utils/TechHider.java index a7704f2..9b0a189 100644 --- a/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/src/de/steamwar/fightsystem/utils/TechHider.java @@ -77,7 +77,7 @@ public class TechHider { if(Config.event()) threadMultiplier = 4; - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ITEM) { + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ITEM) { @Override public void onPacketReceiving(PacketEvent e) { Player p = e.getPlayer(); @@ -86,8 +86,8 @@ public class TechHider { e.setCancelled(true); } } - }).start(threadMultiplier); - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ENTITY) { + }); + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ENTITY) { @Override public void onPacketReceiving(PacketEvent e) { Player p = e.getPlayer(); @@ -96,7 +96,7 @@ public class TechHider { e.setCancelled(true); } } - }).start(threadMultiplier); + }); } public static void start(){ @@ -109,7 +109,7 @@ public class TechHider { Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), packetCache::clear, 1, 1); - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) { + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) { @Override public void onPacketSending(PacketEvent e) { PacketContainer packet = e.getPacket(); @@ -220,8 +220,8 @@ public class TechHider { byteArray.write(0, data); } } - }).start(4 * threadMultiplier); - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) { + }); + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) { @Override public void onPacketSending(PacketEvent e) { PacketContainer packet = e.getPacket(); @@ -247,8 +247,8 @@ public class TechHider { blockStructure.write(0, block); } } - }).start(threadMultiplier); - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) { + }); + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) { @Override public void onPacketSending(PacketEvent e) { PacketContainer packet = e.getPacket(); @@ -283,8 +283,8 @@ public class TechHider { blockStructure.write(0, changes); } } - }).start(threadMultiplier); - ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_ACTION) { + }); + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_ACTION) { @Override public void onPacketSending(PacketEvent e) { PacketContainer packet = e.getPacket(); @@ -296,7 +296,7 @@ public class TechHider { e.setCancelled(true); } - }).start(); + }); } private static boolean bypass(Player p, int chunkX, int chunkZ){