funkemunky

shitty killaura check

Sep 5th, 2018
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.84 KB | None | 0 0
  1. package cc.funkemunky.fiona.detections.combat.killaura.detections;
  2.  
  3. import cc.funkemunky.fiona.data.PlayerData;
  4. import cc.funkemunky.fiona.detections.Check;
  5. import cc.funkemunky.fiona.detections.Detection;
  6. import cc.funkemunky.fiona.events.custom.PacketAttackEvent;
  7. import cc.funkemunky.fiona.events.custom.PacketFunkeMoveEvent;
  8. import cc.funkemunky.fiona.utils.MathUtils;
  9. import cc.funkemunky.fiona.utils.MiscUtils;
  10. import cc.funkemunky.fiona.utils.math.RayTrace;
  11. import com.ngxdev.tinyprotocol.packet.out.WrappedPacketPlayOutWorldParticle;
  12. import org.bukkit.util.Vector;
  13.  
  14. public class Point extends Detection {
  15.     public Point(Check parentCheck, String id, boolean enabled, boolean executable) {
  16.         super(parentCheck, id, enabled, executable);
  17.  
  18.         setExperimental(true);
  19.     }
  20.  
  21.     @Override
  22.     public void onFunkeEvent(Object event, PlayerData data) {
  23.         if(event instanceof PacketAttackEvent) {
  24.             PacketAttackEvent e = (PacketAttackEvent) event;
  25.  
  26.             double distance = e.getAttacker().getEyeLocation().distance(e.getAttacked().getEyeLocation());
  27.  
  28.             if(MathUtils.elapsed(data.lastPointMove, 100L)
  29.                     || distance < 0.8) {
  30.                 return;
  31.             }
  32.  
  33.             RayTrace trace = new RayTrace(e.getAttacker().getEyeLocation().toVector(), e.getAttacker().getEyeLocation().getDirection());
  34.  
  35.             Vector point =trace.positionOfIntersection(MiscUtils.getEntityBoundingBox(e.getAttacked()), 0.75,  distance, distance > 4 ? 0.1 : 0.05);
  36.  
  37.             //WrappedPacketPlayOutWorldParticle particle = new WrappedPacketPlayOutWorldParticle("FLAME", true, (float) point.getX(), (float) point.getY(), (float) point.getZ(), 0f,0f,0f, 0,1, null);
  38.  
  39.             if(data.lastPoint != null
  40.                     && data.deltaXZ > 0) {
  41.                 double pointDif = point.clone().subtract(e.getAttacked().getEyeLocation().toVector()).distance(data.lastPoint);
  42.  
  43.                 if((pointDif < 0.8 && e.getAttacked().getVelocity().length() > 0.08)
  44.                         || pointDif < 0.1) {
  45.                     if(data.pointDifVerbose++ > 15) {
  46.                         flag(data, MathUtils.round(pointDif, 4) + "<-" + (e.getAttacked().getVelocity().length() > 0.14 ? 0.8 : 0.1), 1, true);
  47.                     }
  48.                 } else {
  49.                     data.pointDifVerbose = 0;
  50.                 }
  51.                 debug(data, data.pointDifVerbose + ": " + pointDif);
  52.             }
  53.             //particle.sendPacket(e.getAttacker());
  54.  
  55.             data.lastPoint = point.clone().subtract(e.getAttacked().getEyeLocation().toVector());
  56.         } else if(event instanceof PacketFunkeMoveEvent) {
  57.             PacketFunkeMoveEvent e = (PacketFunkeMoveEvent) event;
  58.  
  59.             if(MathUtils.moved(e.getFrom(), e.getTo())) data.lastPointMove = System.currentTimeMillis();
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment