SteamWar/FightSystem
Archiviert
13
1

Starting Techhider delayed while schematicpasting

Dieser Commit ist enthalten in:
Lixfel 2019-10-07 08:23:24 +02:00
Ursprung 8a1aa18ace
Commit a3331788d4
2 geänderte Dateien mit 33 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -292,6 +292,7 @@ public class FightTeam {
if(Config.test())
pasteSchematic();
else if(Fight.getOpposite(this).hasSchematic()){
TechHider.start();
pasteSchematic();
Fight.getOpposite(this).pasteSchematic();
}

Datei anzeigen

@ -50,6 +50,8 @@ public class TechHider {
private static short obfuscateShift4;
private static final short BITMASK = 0x1FF;
private static Material obfuscateMaterial;
private static boolean running = false;
private static int threadMultiplier = 1;
public static void init(){
if(disabled())
@ -72,10 +74,39 @@ public class TechHider {
obfuscateShift4 = (short)(Config.ObfuscateWith << 4);
obfuscateMaterial = Material.getMaterial(Config.ObfuscateWith);
int threadMultiplier = 1;
if(Config.event())
threadMultiplier = 4;
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ITEM) {
@Override
public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer();
if(p.getGameMode() == GameMode.SPECTATOR){
e.setCancelled(true);
}
}
}).start(threadMultiplier);
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ENTITY) {
@Override
public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer();
if(p.getGameMode() == GameMode.SPECTATOR){
e.setCancelled(true);
}
}
}).start(threadMultiplier);
}
public static void start(){
if(running)
return;
running = true;
if(disabled())
return;
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
@Override
public void onPacketSending(PacketEvent e) {
@ -243,26 +274,6 @@ public class TechHider {
e.setCancelled(true);
}
}).start();
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ITEM) {
@Override
public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer();
if(p.getGameMode() == GameMode.SPECTATOR){
e.setCancelled(true);
}
}
}).start(threadMultiplier);
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.USE_ENTITY) {
@Override
public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer();
if(p.getGameMode() == GameMode.SPECTATOR){
e.setCancelled(true);
}
}
}).start(threadMultiplier);
}
private static boolean bypass(Player p, int chunkX, int chunkZ){