SteamWar/FightSystem
Archiviert
13
1

Remove nocom detection
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-02-17 15:15:08 +01:00
Ursprung 75e3096b55
Commit 64d34063b8

Datei anzeigen

@ -22,10 +22,6 @@ package de.steamwar.fightsystem.listener;
import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.sql.SWException;
import de.steamwar.techhider.ProtocolUtils;
import de.steamwar.techhider.TechHider;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -38,7 +34,6 @@ public class AntiCheat {
TinyProtocol.instance.addFilter(teleport, this::onTeleport); TinyProtocol.instance.addFilter(teleport, this::onTeleport);
TinyProtocol.instance.addFilter(position, this::onMove); TinyProtocol.instance.addFilter(position, this::onMove);
TinyProtocol.instance.addFilter(positionLook, this::onMove); TinyProtocol.instance.addFilter(positionLook, this::onMove);
TinyProtocol.instance.addFilter(blockDig, this::onDig);
} }
private static final Class<?> flying = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying"); private static final Class<?> flying = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying");
@ -88,20 +83,6 @@ public class AntiCheat {
return packet; return packet;
} }
private static final Class<?> blockDig = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockDig");
private static final Reflection.FieldAccessor<?> digPosition = Reflection.getField(blockDig, TechHider.blockPosition, 0);
private Object onDig(Player player, Object packet) {
Object pos = digPosition.get(packet);
int x = TechHider.blockPositionX.get(pos);
int z = TechHider.blockPositionZ.get(pos);
if(!player.getWorld().isChunkLoaded(ProtocolUtils.posToChunk(x), ProtocolUtils.posToChunk(z))) {
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> player.kickPlayer(null));
SWException.log(player.getName() + " tried to dig an unloaded block", "");
return null;
}
return packet;
}
private static class Movement { private static class Movement {
private final double x; private final double x;
private final double y; private final double y;