SteamWar/FightSystem
Archiviert
13
1

Synchronizing Techhider to prevent block-bug

Dieser Commit ist enthalten in:
Lixfel 2019-11-08 09:32:43 +01:00
Ursprung 40589ec351
Commit 3247ea737c

Datei anzeigen

@ -77,7 +77,7 @@ public class TechHider {
if(Config.event()) if(Config.event())
threadMultiplier = 4; 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 @Override
public void onPacketReceiving(PacketEvent e) { public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
@ -86,8 +86,8 @@ public class TechHider {
e.setCancelled(true); 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 @Override
public void onPacketReceiving(PacketEvent e) { public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
@ -96,7 +96,7 @@ public class TechHider {
e.setCancelled(true); e.setCancelled(true);
} }
} }
}).start(threadMultiplier); });
} }
public static void start(){ public static void start(){
@ -109,7 +109,7 @@ public class TechHider {
Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), packetCache::clear, 1, 1); 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 @Override
public void onPacketSending(PacketEvent e) { public void onPacketSending(PacketEvent e) {
PacketContainer packet = e.getPacket(); PacketContainer packet = e.getPacket();
@ -220,8 +220,8 @@ public class TechHider {
byteArray.write(0, data); 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 @Override
public void onPacketSending(PacketEvent e) { public void onPacketSending(PacketEvent e) {
PacketContainer packet = e.getPacket(); PacketContainer packet = e.getPacket();
@ -247,8 +247,8 @@ public class TechHider {
blockStructure.write(0, block); 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 @Override
public void onPacketSending(PacketEvent e) { public void onPacketSending(PacketEvent e) {
PacketContainer packet = e.getPacket(); PacketContainer packet = e.getPacket();
@ -283,8 +283,8 @@ public class TechHider {
blockStructure.write(0, changes); 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 @Override
public void onPacketSending(PacketEvent e) { public void onPacketSending(PacketEvent e) {
PacketContainer packet = e.getPacket(); PacketContainer packet = e.getPacket();
@ -296,7 +296,7 @@ public class TechHider {
e.setCancelled(true); e.setCancelled(true);
} }
}).start(); });
} }
private static boolean bypass(Player p, int chunkX, int chunkZ){ private static boolean bypass(Player p, int chunkX, int chunkZ){