Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cc.funkemunky.fiona.detections.combat.killaura.detections;
- import cc.funkemunky.fiona.data.PlayerData;
- import cc.funkemunky.fiona.detections.Check;
- import cc.funkemunky.fiona.detections.Detection;
- import cc.funkemunky.fiona.events.custom.PacketAttackEvent;
- import cc.funkemunky.fiona.events.custom.PacketFunkeMoveEvent;
- import cc.funkemunky.fiona.utils.MathUtils;
- import cc.funkemunky.fiona.utils.MiscUtils;
- import cc.funkemunky.fiona.utils.math.RayTrace;
- import com.ngxdev.tinyprotocol.packet.out.WrappedPacketPlayOutWorldParticle;
- import org.bukkit.util.Vector;
- public class Point extends Detection {
- public Point(Check parentCheck, String id, boolean enabled, boolean executable) {
- super(parentCheck, id, enabled, executable);
- setExperimental(true);
- }
- @Override
- public void onFunkeEvent(Object event, PlayerData data) {
- if(event instanceof PacketAttackEvent) {
- PacketAttackEvent e = (PacketAttackEvent) event;
- double distance = e.getAttacker().getEyeLocation().distance(e.getAttacked().getEyeLocation());
- if(MathUtils.elapsed(data.lastPointMove, 100L)
- || distance < 0.8) {
- return;
- }
- RayTrace trace = new RayTrace(e.getAttacker().getEyeLocation().toVector(), e.getAttacker().getEyeLocation().getDirection());
- Vector point =trace.positionOfIntersection(MiscUtils.getEntityBoundingBox(e.getAttacked()), 0.75, distance, distance > 4 ? 0.1 : 0.05);
- //WrappedPacketPlayOutWorldParticle particle = new WrappedPacketPlayOutWorldParticle("FLAME", true, (float) point.getX(), (float) point.getY(), (float) point.getZ(), 0f,0f,0f, 0,1, null);
- if(data.lastPoint != null
- && data.deltaXZ > 0) {
- double pointDif = point.clone().subtract(e.getAttacked().getEyeLocation().toVector()).distance(data.lastPoint);
- if((pointDif < 0.8 && e.getAttacked().getVelocity().length() > 0.08)
- || pointDif < 0.1) {
- if(data.pointDifVerbose++ > 15) {
- flag(data, MathUtils.round(pointDif, 4) + "<-" + (e.getAttacked().getVelocity().length() > 0.14 ? 0.8 : 0.1), 1, true);
- }
- } else {
- data.pointDifVerbose = 0;
- }
- debug(data, data.pointDifVerbose + ": " + pointDif);
- }
- //particle.sendPacket(e.getAttacker());
- data.lastPoint = point.clone().subtract(e.getAttacked().getEyeLocation().toVector());
- } else if(event instanceof PacketFunkeMoveEvent) {
- PacketFunkeMoveEvent e = (PacketFunkeMoveEvent) event;
- if(MathUtils.moved(e.getFrom(), e.getTo())) data.lastPointMove = System.currentTimeMillis();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment