Making techhider processing fully async
Dieser Commit ist enthalten in:
Ursprung
5d5884ca1b
Commit
d430311693
@ -66,7 +66,7 @@ public class TechHider {
|
||||
obfuscateShift4 = (short)(Config.ObfuscateWith << 4);
|
||||
obfuscateMaterial = Material.getMaterial(Config.ObfuscateWith);
|
||||
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
|
||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent e) {
|
||||
PacketContainer packet = e.getPacket();
|
||||
@ -165,8 +165,9 @@ public class TechHider {
|
||||
byteArray.write(0, Bytes.toArray(newData));
|
||||
}
|
||||
}
|
||||
});
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
||||
}).start();
|
||||
|
||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent e) {
|
||||
PacketContainer packet = e.getPacket();
|
||||
@ -185,8 +186,8 @@ public class TechHider {
|
||||
blockStructure.write(0, block);
|
||||
}
|
||||
}
|
||||
});
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
|
||||
}).start();
|
||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent e) {
|
||||
PacketContainer packet = e.getPacket();
|
||||
@ -214,8 +215,8 @@ public class TechHider {
|
||||
blockStructure.write(0, changes);
|
||||
}
|
||||
}
|
||||
});
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_ACTION) {
|
||||
}).start();
|
||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_ACTION) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent e) {
|
||||
PacketContainer packet = e.getPacket();
|
||||
@ -227,8 +228,8 @@ public class TechHider {
|
||||
|
||||
e.setCancelled(true);
|
||||
}
|
||||
});
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ITEM) {
|
||||
}).start();
|
||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ITEM) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
@ -237,8 +238,8 @@ public class TechHider {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ENTITY) {
|
||||
}).start();
|
||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ENTITY) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
@ -247,23 +248,17 @@ public class TechHider {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}).start();
|
||||
}
|
||||
|
||||
private static boolean bypass(Player p, int chunkX, int chunkZ){
|
||||
if(
|
||||
arenaMinX > chunkX ||
|
||||
chunkX > arenaMaxX ||
|
||||
arenaMinZ > chunkZ ||
|
||||
chunkZ > arenaMaxZ
|
||||
){
|
||||
//Außerhalb der Arena
|
||||
return true;
|
||||
}
|
||||
|
||||
FightTeam ft = Fight.getPlayerTeam(p);
|
||||
if(ft == null){
|
||||
return false;
|
||||
//Außerhalb der Arena
|
||||
return arenaMinX > chunkX ||
|
||||
chunkX > arenaMaxX ||
|
||||
arenaMinZ > chunkZ ||
|
||||
chunkZ > arenaMaxZ;
|
||||
}else if(ft.isBlue()){
|
||||
return FightSystem.isEntern() ||
|
||||
redMinX > chunkX ||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren