Advertisement
Guest User

PlayerData

a guest
Aug 18th, 2017
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.15 KB | None | 0 0
  1. package com.chaoticmc.alpha.data;
  2.  
  3. import java.text.SimpleDateFormat;
  4. import java.util.ArrayList;
  5. import java.util.Date;
  6. import java.util.List;
  7.  
  8. import org.bukkit.ChatColor;
  9. import org.bukkit.Location;
  10. import org.bukkit.Material;
  11. import org.bukkit.World;
  12. import org.bukkit.entity.LivingEntity;
  13. import org.bukkit.entity.Player;
  14.  
  15. import com.chaoticmc.alpha.AlphaPlugin;
  16. import com.chaoticmc.alpha.api.API;
  17. import com.chaoticmc.alpha.events.Event;
  18. import com.chaoticmc.alpha.events.event.ASyncMovementEvent;
  19. import com.chaoticmc.alpha.events.event.AttackEvent;
  20. import com.chaoticmc.alpha.events.event.FlyingEvent;
  21. import com.chaoticmc.alpha.events.event.InteractEvent;
  22. import com.chaoticmc.alpha.events.event.MovementEvent;
  23. import com.chaoticmc.alpha.events.event.SwingEvent;
  24. import com.chaoticmc.alpha.events.event.TeleportEvent;
  25. import com.chaoticmc.alpha.events.event.UseEntityEvent;
  26. import com.chaoticmc.alpha.events.event.VehicleEvent;
  27. import com.chaoticmc.alpha.events.interfaces.IEventListener;
  28. import com.chaoticmc.alpha.utils.AverageCollector;
  29. import com.chaoticmc.alpha.utils.SmallAverageCollector;
  30. import com.chaoticmc.alpha.utils.StorageUtils;
  31. import com.chaoticmc.alpha.utils.Timer;
  32. import com.chaoticmc.alpha.utils.TrigUtils;
  33.  
  34. import net.md_5.bungee.api.chat.BaseComponent;
  35. import net.md_5.bungee.api.chat.ClickEvent;
  36. import net.md_5.bungee.api.chat.ClickEvent.Action;
  37. import net.md_5.bungee.api.chat.ComponentBuilder;
  38.  
  39. public class PlayerData
  40. implements IEventListener
  41. {
  42. private Player player;
  43. private API api;
  44. public long kaTypeBLastMoveTime;
  45. public int kaTypeBExcusedCooldown;
  46. public int combinedBVL;
  47. public long acTypeCLastSwingTime;
  48. public long acTypeCCurrentSwingTime;
  49. public long acTypeCLastSwingDelay;
  50. public long acTypeCCurrentSwingDelay;
  51. public SmallAverageCollector acTypeCCollector;
  52. public double acTypeCLastAverage;
  53. public double acTypeCMaxVL;
  54. public long acTypeClastHitTime;
  55. public int kaTypeEAimVL;
  56. public int kaTypeEHits;
  57. public int kaTypeEMisses;
  58. public long kaTypeECurrentSwingTime;
  59. public long kaTypeELastSwingTime;
  60. public long kaTypeECurrentDelay;
  61. public long kaTypeELastDelay;
  62. public AverageCollector kaTypeEConsistantCollector;
  63. public int kaTypeEDirectionVL;
  64. public double fullVL;
  65. public int hmrLookHits;
  66. public int hmrLookMisses;
  67. public int hmrLookVL;
  68. public int kaTypeBPackets;
  69. public long acTypeBLastSwingTime;
  70. public int acTypeBDoubleClickVL;
  71. public double acTypeBLastDelay;
  72. public float hmrLastYaw;
  73. public float hmrCurrentYaw;
  74. public float hmrYawDelta;
  75. public int hmrYawPackets;
  76. public long hmrLastHitTime;
  77. public boolean hmrInBattle;
  78. public long acTypeBLastPacketTime;
  79. public int kaTypeEVL;
  80. public int kaTypeFMisses;
  81. public int kaTypeFHits;
  82. public int kaTypeFOverall;
  83. public SmallAverageCollector kaTypeFReachCollector;
  84. public SmallAverageCollector kaTypeFViolationCollector;
  85. public int kaTypeFVL;
  86. private boolean ground;
  87. private boolean web;
  88. private boolean ladder;
  89. private boolean vehicle;
  90. private boolean vine;
  91. private boolean water;
  92. private boolean lava;
  93. private boolean slime;
  94. private boolean piston;
  95. private boolean ice;
  96. private boolean underBlock;
  97. private boolean playerGround;
  98. private double x;
  99. private double y;
  100. private double z;
  101. private float yaw;
  102. private float pitch;
  103. private double lastX;
  104. private double lastY;
  105. private double lastZ;
  106. private float lastYaw;
  107. private float lastPitch;
  108. private double xDelta;
  109. private double yDelta;
  110. private double zDelta;
  111. private float yawDelta;
  112. private float pitchDelta;
  113. private Location currentLocation;
  114. private Location previousLocation;
  115. private Location currentTargetLocation;
  116. private Location previousTargetLocation;
  117. public Location blockGlitchSetbackLocation;
  118. private World currentWorld;
  119. private World previousWorld;
  120. private LivingEntity target;
  121. private LivingEntity lastTarget;
  122. private int clicks;
  123. private int swings;
  124. private int cps;
  125. private double lastReachDistance;
  126. private int hits;
  127. private int misses;
  128. private long lastPacketTime;
  129. private long lastPacketID;
  130. private String detectedHack;
  131. private String detectedHackData;
  132. private Timer cpsTimer;
  133. private Timer attackTimer;
  134. private Timer coolDownTimer;
  135. private Timer checkTimer;
  136. private Timer addTimer;
  137. public double jumpHeight;
  138. public double flyVL;
  139. public double fallSpeed;
  140. public int airTicks;
  141. public double glideVL;
  142. public double yFreedom;
  143. public int fallTicks;
  144. private int allowanceVL;
  145. public String lastTickOrdinal;
  146. public boolean flySlime;
  147. public double stepVL;
  148. public double hFreedom;
  149. public double lastSpeedLowJumpVL;
  150. public double speedLowJumpVL;
  151. public int bunnyHopDelay;
  152. public double speedVL;
  153. public double packetBuffer;
  154. public boolean noSwingHasSwung;
  155. public double noSwingVL;
  156. private double banVL;
  157. private String banCommand;
  158. private long banTime;
  159. private long actualBanTime;
  160. public boolean autobanning;
  161.  
  162. public PlayerData(Player player)
  163. {
  164. this.player = player;
  165. this.api = AlphaPlugin.getAPI();
  166.  
  167. this.api.getEventManager().addPlayerListener(this);
  168. }
  169.  
  170. public Player getPlayer()
  171. {
  172. return this.player;
  173. }
  174.  
  175. public void addBanVL(String reason, double banVL)
  176. {
  177. if (banVL > 0.3D) {
  178. banVL = 0.3D;
  179. }
  180. this.banVL += banVL;
  181. this.autobanCooldown = (System.currentTimeMillis() + 5000L);
  182. if (this.banVL > this.api.getConfiguration().readDouble("AutoBan.VL"))
  183. {
  184. autoBan(reason);
  185. this.banVL = 0.0D;
  186. }
  187. }
  188.  
  189. public boolean inWeb()
  190. {
  191. return this.web;
  192. }
  193.  
  194. public boolean onLadder()
  195. {
  196. return this.ladder;
  197. }
  198.  
  199. public boolean inVehicle()
  200. {
  201. return this.vehicle;
  202. }
  203.  
  204. public boolean onVine()
  205. {
  206. return this.vine;
  207. }
  208.  
  209. public boolean inWater()
  210. {
  211. return this.water;
  212. }
  213.  
  214. public boolean inLava()
  215. {
  216. return this.lava;
  217. }
  218.  
  219. public boolean isUnderBlock()
  220. {
  221. return this.underBlock;
  222. }
  223.  
  224. public boolean onIce()
  225. {
  226. return this.ice;
  227. }
  228.  
  229. public boolean onSlime()
  230. {
  231. return this.slime;
  232. }
  233.  
  234. public double getX()
  235. {
  236. return this.x;
  237. }
  238.  
  239. public double getY()
  240. {
  241. return this.y;
  242. }
  243.  
  244. public double getZ()
  245. {
  246. return this.z;
  247. }
  248.  
  249. public float getYaw()
  250. {
  251. return this.yaw;
  252. }
  253.  
  254. public float getPitch()
  255. {
  256. return this.pitch;
  257. }
  258.  
  259. public double getDeltaX()
  260. {
  261. return this.xDelta;
  262. }
  263.  
  264. public double getDeltaY()
  265. {
  266. return this.yDelta;
  267. }
  268.  
  269. public double getDeltaZ()
  270. {
  271. return this.zDelta;
  272. }
  273.  
  274. public float getDeltaYaw()
  275. {
  276. return Math.abs(Math.abs(TrigUtils.wrapAngleTo180_float(getYaw())) - Math.abs(TrigUtils.wrapAngleTo180_float(getLastYaw())));
  277. }
  278.  
  279. public float getDeltaPitch()
  280. {
  281. return this.pitchDelta;
  282. }
  283.  
  284. public Location getLocation()
  285. {
  286. return this.currentLocation;
  287. }
  288.  
  289. public Location getLastLocation()
  290. {
  291. return this.previousLocation;
  292. }
  293.  
  294. public World getWorld()
  295. {
  296. return this.currentWorld;
  297. }
  298.  
  299. public World getLastWorld()
  300. {
  301. return this.previousWorld;
  302. }
  303.  
  304. public LivingEntity getTarget()
  305. {
  306. return this.target;
  307. }
  308.  
  309. public boolean isOnGround()
  310. {
  311. return this.ground;
  312. }
  313.  
  314. public double getLastReachDistance()
  315. {
  316. return this.lastReachDistance;
  317. }
  318.  
  319. public int getHits()
  320. {
  321. return this.hits;
  322. }
  323.  
  324. public LivingEntity getLastTarget()
  325. {
  326. return this.lastTarget;
  327. }
  328.  
  329. public int getMisses()
  330. {
  331. return this.misses;
  332. }
  333.  
  334. public long getLastPacketID()
  335. {
  336. return this.lastPacketID;
  337. }
  338.  
  339. public long getLastPacketTime()
  340. {
  341. return this.lastPacketTime;
  342. }
  343.  
  344. public int getCPS()
  345. {
  346. return this.cps;
  347. }
  348.  
  349. public boolean isPlayerOnGround()
  350. {
  351. return this.playerGround;
  352. }
  353.  
  354. private void setPositionAndUpdate(double x, double y, double z)
  355. {
  356. this.lastX = this.x;
  357. this.lastY = this.y;
  358. this.lastZ = this.z;
  359. this.x = x;
  360. this.y = y;
  361. this.z = z;
  362. if (this.lastX != 0.0D) {
  363. this.xDelta = (this.x - this.lastX);
  364. }
  365. if (this.lastY != 0.0D) {
  366. this.yDelta = (this.y - this.lastY);
  367. }
  368. if (this.lastZ != 0.0D) {
  369. this.zDelta = (this.z - this.lastZ);
  370. }
  371. if (Math.abs(this.xDelta) > 10.0D) {
  372. this.xDelta = 0.0D;
  373. }
  374. if (Math.abs(this.zDelta) > 10.0D) {
  375. this.zDelta = 0.0D;
  376. }
  377. if (Math.abs(this.yDelta) > 10.0D) {
  378. this.yDelta = 0.0D;
  379. }
  380. }
  381.  
  382. private void setRotationsAndUpdate(float yaw, float pitch)
  383. {
  384. this.lastYaw = this.yaw;
  385. this.lastPitch = this.pitch;
  386. this.yaw = yaw;
  387. this.pitch = pitch;
  388. setYawDelta(Math.abs(this.yaw - this.lastYaw));
  389. this.pitchDelta = Math.abs(this.pitch - this.lastPitch);
  390. }
  391.  
  392. private void updateLocation(Location location)
  393. {
  394. if (location == null) {
  395. return;
  396. }
  397. if (this.currentLocation == null) {
  398. this.currentLocation = location;
  399. }
  400. if (this.previousLocation == null) {
  401. this.previousLocation = location;
  402. }
  403. if ((this.currentTargetLocation == null) && (getTarget() != null)) {
  404. this.currentTargetLocation = getTarget().getLocation();
  405. }
  406. if ((this.previousTargetLocation == null) && (this.currentTargetLocation != null)) {
  407. this.previousTargetLocation = this.currentTargetLocation;
  408. }
  409. this.previousLocation = this.currentLocation;
  410. this.previousTargetLocation = this.currentTargetLocation;
  411. this.previousWorld = this.currentLocation.getWorld();
  412.  
  413. setPositionAndUpdate(location.getX(), location.getY(), location.getZ());
  414. setRotationsAndUpdate(location.getYaw(), location.getPitch());
  415.  
  416. this.currentLocation = location;
  417. this.currentWorld = location.getWorld();
  418. if (getTarget() != null) {
  419. this.currentTargetLocation = getTarget().getLocation();
  420. }
  421. }
  422.  
  423. private boolean notifiedAutoban = true;
  424. private long autobanCooldown;
  425. private int cpsPackets;
  426. private double lag;
  427. private Timer packetTimer;
  428. private int lagPackets;
  429. private Location teleportLocation;
  430. private AverageCollector lagCollector;
  431.  
  432. private void autoBan(String reason)
  433. {
  434. if ((this.api.getConfiguration().readBoolean("AutoBan.Enabled")) && (!this.autobanning))
  435. {
  436. String banMessage = color(this.api.getConfiguration().readString("AutoBan.Message").replace("%reason%", reason));
  437. this.banCommand = color(this.api.getConfiguration().readString("AutoBan.Command").replace("%player%", getPlayer().getName()).replace("%message%", banMessage));
  438. this.banTime = (this.api.getConfiguration().readInteger("AutoBan.Delay") * 1000);
  439. this.actualBanTime = (System.currentTimeMillis() + this.banTime);
  440. this.autobanning = true;
  441. this.notifiedAutoban = false;
  442. }
  443. }
  444.  
  445. private void resetData(double x, double y, double z)
  446. {
  447. this.ground = true;
  448. this.playerGround = true;
  449. this.web = false;
  450. this.ladder = false;
  451. this.vehicle = false;
  452. this.vine = false;
  453. this.water = false;
  454. this.lava = false;
  455. this.slime = false;
  456. this.piston = false;
  457. this.ice = false;
  458. this.underBlock = false;
  459. this.x = x;
  460. this.y = y;
  461. this.z = z;
  462. this.lastX = 0.0D;
  463. this.lastY = 0.0D;
  464. this.lastZ = 0.0D;
  465. this.lastYaw = 0.0F;
  466. this.lastPitch = 0.0F;
  467. this.xDelta = 0.0D;
  468. this.yDelta = 0.0D;
  469. this.zDelta = 0.0D;
  470. setYawDelta(0.0F);
  471. this.pitchDelta = 0.0F;
  472. this.currentLocation = null;
  473. this.previousLocation = null;
  474. this.currentTargetLocation = null;
  475. this.previousTargetLocation = null;
  476. this.currentWorld = null;
  477. this.previousWorld = null;
  478. this.target = null;
  479. this.lastTarget = null;
  480. this.jumpHeight = 0.0D;
  481. this.yFreedom = 0.0D;
  482. this.flyVL = 0.0D;
  483. this.fallSpeed = 0.0D;
  484. this.airTicks = 0;
  485. this.glideVL = 0.0D;
  486. this.yFreedom += 1.3D;
  487. this.fallTicks = 0;
  488. this.allowanceVL = 0;
  489. this.lastTickOrdinal = "Neutral";
  490. this.flySlime = false;
  491. this.stepVL = 0.0D;
  492. this.hFreedom = 0.0D;
  493. this.lastSpeedLowJumpVL = 0.0D;
  494. this.speedLowJumpVL = 0.0D;
  495. this.bunnyHopDelay = 0;
  496. this.speedVL = 0.0D;
  497. }
  498.  
  499. public boolean isTeleporting()
  500. {
  501. return this.teleportLocation != null;
  502. }
  503.  
  504. public void onEvent(Event e)
  505. {
  506. if (!e.getPlayer().equals(this)) {
  507. return;
  508. }
  509. if ((e instanceof VehicleEvent)) {
  510. this.vehicleTicks = 10;
  511. }
  512. if ((e instanceof TeleportEvent)) {
  513. this.teleportLocation = ((TeleportEvent)e).getTo();
  514. }
  515. if (((e instanceof ASyncMovementEvent)) &&
  516. (this.teleportLocation != null))
  517. {
  518. double x = ((ASyncMovementEvent)e).getX();
  519. double y = ((ASyncMovementEvent)e).getY();
  520. double z = ((ASyncMovementEvent)e).getZ();
  521. double tX = this.teleportLocation.getX();
  522. double tY = this.teleportLocation.getY();
  523. double tZ = this.teleportLocation.getZ();
  524. double difX = Math.abs(x - tX);
  525. double difY = Math.abs(y - tY);
  526. double difZ = Math.abs(z - tZ);
  527. if ((difX == 0.0D) && (difZ == 0.0D) && (difY < 1.0E-5D))
  528. {
  529. this.teleportLocation = null;
  530. resetData(x, y, z);
  531. }
  532. return;
  533. }
  534. if (((e instanceof FlyingEvent)) || ((e instanceof ASyncMovementEvent)))
  535. {
  536. this.lagPackets += 1;
  537. if (this.lagCollector == null) {
  538. this.lagCollector = new AverageCollector();
  539. }
  540. if (this.packetTimer != null)
  541. {
  542. if (this.packetTimer.hasReached(1000L))
  543. {
  544. this.packetTimer.reset();
  545. double lag = Math.abs(this.lagPackets / 20);
  546. if (this.packetTimer.getTime() > 1000.0D) {
  547. lag -= this.packetTimer.getTime() / 1000.0D;
  548. }
  549. this.lagCollector.add(lag);
  550. if (this.lagCollector.getDataAmount() > 1)
  551. {
  552. this.lag = this.lagCollector.getAverage();
  553. this.lagCollector.clear();
  554. }
  555. this.lagPackets = 0;
  556. }
  557. }
  558. else {
  559. this.packetTimer = new Timer();
  560. }
  561. this.lastPacketTime = System.currentTimeMillis();
  562. this.lastPacketID += 1L;
  563. this.cpsPackets += 1;
  564. if (this.attackTimer == null) {
  565. this.attackTimer = new Timer();
  566. }
  567. if ((this.attackTimer.hasReached(5000L)) && (this.target != null))
  568. {
  569. this.attackTimer.reset();
  570. this.target = null;
  571. this.lastReachDistance = 0.0D;
  572. this.cps = 0;
  573. this.hits = 0;
  574. this.misses = 0;
  575. }
  576. if (System.currentTimeMillis() > this.autobanCooldown)
  577. {
  578. this.autobanCooldown = (System.currentTimeMillis() + 5000L);
  579. this.banVL *= 0.9D;
  580. }
  581. if (this.cpsTimer != null)
  582. {
  583. if (this.cpsTimer.hasReached(1000L))
  584. {
  585. this.cpsTimer.reset();
  586. int rightClicks = this.clicks - this.swings;
  587. if (rightClicks < 0) {
  588. rightClicks = 0;
  589. }
  590. this.cps = this.swings;
  591. this.acInteractions = 0;
  592. if (this.cpsPackets < 20) {
  593. this.cps -= Math.abs(this.cpsPackets - 20);
  594. }
  595. if (this.cps < 0) {
  596. this.cps = 0;
  597. }
  598. this.cpsPackets = 0;
  599.  
  600. this.clicks = 0;
  601. this.swings = 0;
  602. }
  603. }
  604. else {
  605. this.cpsTimer = new Timer();
  606. }
  607. }
  608. if(e.getAction == Action.LEFT_CLICK_BLOCK) {
  609. this.swings -= 2;
  610. }
  611. if (e instanceof UseEntityEvent) {
  612. ++this.clicks;
  613. ++this.hits;
  614. --this.misses;
  615. if (this.misses < 0) {
  616. this.misses = 0;
  617. }
  618. }
  619. if ((e instanceof AttackEvent))
  620. {
  621. this.lastTarget = this.target;
  622.  
  623. LivingEntity target = ((AttackEvent)e).getTarget();
  624. if ((target instanceof Player))
  625. {
  626. this.target = target;
  627. if ((target.getWorld() != null) && (this.player.getWorld() != null) &&
  628. (target.getWorld().equals(this.player.getWorld()))) {
  629. this.lastReachDistance = target.getLocation().distance(this.player.getLocation());
  630. }
  631. if (this.attackTimer == null) {
  632. this.attackTimer = new Timer();
  633. }
  634. this.attackTimer.reset();
  635. if (!this.target.equals(this.lastTarget))
  636. {
  637. this.hits = 0;
  638. this.misses = 0;
  639. }
  640. }
  641. else
  642. {
  643. this.target = null;
  644. }
  645. }
  646. if ((e instanceof SwingEvent))
  647. {
  648. this.swings += 1;
  649. this.misses += 1;
  650. }
  651. if ((e instanceof MovementEvent))
  652. {
  653. this.vehicleTicks -= 1;
  654. if (this.vehicleTicks < 0) {
  655. this.vehicleTicks = 0;
  656. }
  657. if ((!this.notifiedAutoban) && (this.banTime > 0L))
  658. {
  659. BaseComponent[] formattedMessage = new ComponentBuilder(ChatColor.RESET.toString()).event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/alpha stopban " + getPlayer().getName())).append(this.api.getTextManager().getString("core.AlphaBanMessage").replace("%seconds%", "" + this.banTime / 1000L).replace("%player%", getPlayer().getName())).create();
  660. for (Player p : this.api.getPlugin().getServer().getOnlinePlayers()) {
  661. if ((p.hasPermission("alpha.notify")) || (p.isOp())) {
  662. p.spigot().sendMessage(formattedMessage);
  663. }
  664. }
  665. this.notifiedAutoban = true;
  666. }
  667. if ((this.autobanning) &&
  668. (System.currentTimeMillis() > this.actualBanTime))
  669. {
  670. AlphaPlugin.getAPI().getPlugin().getServer().dispatchCommand(AlphaPlugin.getAPI().getPlugin().getServer().getConsoleSender(), this.banCommand);
  671. String broadcastMessage = ChatColor.translateAlternateColorCodes('&', this.api.getConfiguration().readString("AutoBan.BroadcastMessage").replace("%player%", this.player.getName()));
  672. if (broadcastMessage.length() > 0) {
  673. for (Player p : this.api.getPlugin().getServer().getOnlinePlayers()) {
  674. p.sendMessage(broadcastMessage);
  675. }
  676. }
  677. this.autobanning = false;
  678. }
  679. updateLocation(((MovementEvent)e).getTo());
  680. updateTerrain();
  681. if ((!isInBlock()) && (!this.player.getLocation().getBlock().getType().isSolid()) &&
  682. (isOnGround()) &&
  683. (Math.abs(this.lastPhaseTime - System.currentTimeMillis()) > 2000L)) {
  684. this.phaseSetback = this.player.getLocation();
  685. }
  686. if (this.checkTimer == null) {
  687. this.checkTimer = new Timer();
  688. }
  689. if (this.checkTimer.hasReached(this.api.getConfiguration().readInteger("core.NotifyDelayMS")))
  690. {
  691. this.checkTimer.reset();
  692. if (this.failedQueue == null) {
  693. this.failedQueue = new ArrayList();
  694. }
  695. if (this.failedQueue.size() > 0)
  696. {
  697. String queueMessage = (String)this.failedQueue.get(0);
  698. this.detectedHack = queueMessage.split(",")[0].replace("%%comma%%", ",");
  699. this.detectedHackData = queueMessage.split(",")[1].replace("%%comma%%", ",");
  700.  
  701. this.api.getDataManager().legacyNotifyCheck(this);
  702. this.failedQueue.remove(0);
  703. }
  704. }
  705. }
  706. if ((e instanceof ASyncMovementEvent))
  707. {
  708. this.playerGround = ((ASyncMovementEvent)e).isOnGround();
  709. if (this.coolDownTimer == null) {
  710. this.coolDownTimer = new Timer();
  711. }
  712. if (this.coolDownTimer.hasReached(this.api.getConfiguration().readInteger("core.CoolDownDelay")))
  713. {
  714. this.flyVL *= 0.99D;
  715. this.glideVL *= 0.99D;
  716. this.stepVL *= 0.99D;
  717. this.speedVL *= 0.99D;
  718.  
  719. this.coolDownTimer.reset();
  720. }
  721. }
  722. }
  723.  
  724. private List<String> failedQueue = new ArrayList();
  725. public int hmrPackets;
  726. public double hmrYawTotal;
  727. public double hmrSpeedTotal;
  728. public int hmrYawCumulator;
  729. public double hmrSpeedCumulator;
  730. public int hmrPacketSwings;
  731. public int hmrPacketHits;
  732. public int hmrCamVL;
  733. public float aimbotBuffer;
  734. public int aimbotSwings;
  735. public long directionLastPacketTime;
  736. public Timer mpPacketTimer;
  737. public int mpPackets;
  738. public double mpVL;
  739. public long acLastSwingCPS;
  740. public double acincvl;
  741. public double acLastCPS;
  742. public double acConsBuf;
  743. public float lastYawDelta;
  744. public double trigLookDifs;
  745. public double trigNotLookDifs;
  746. public int trigSwings;
  747. public long trigLastSwingCPS;
  748. public double trigVL;
  749. public double lookVL;
  750. public int lookBuffer;
  751. public int aimbotPackets;
  752. public int notLookBuffer;
  753. public float totalYawDelta;
  754. public long aimbotLastPacketTime;
  755. public long trigLastPacketTime;
  756. public double failVL;
  757. public int combinedVL;
  758. public int hmrpacketBuffer;
  759. public double lastTargetSpeed;
  760. public double hmrLastTargetSpeed;
  761. public float hmrLastYawDelta;
  762. public double hmrLastPlayerSpeed;
  763. public float lastAimbotYaw;
  764. public float totalAimbot;
  765. public float exactLastAimbotYaw;
  766. public float totalAimbotYaw;
  767. public float totalAimbotDifference;
  768. public int aimbotVL;
  769. public int hmrPacketMisses;
  770. public float aimbotLastYawDelta;
  771. public double lastRatio;
  772. public int hmrRatioConsistancyVL;
  773. public int hmrPacketVL;
  774. public double combinedMax;
  775. public float aimbotTotalYaw;
  776. public long ignorePlayerLeniency;
  777. private boolean inBlock;
  778. public boolean wasInBlock;
  779. public int noclipVL;
  780. public int jesusVL;
  781. public long lastPhaseTime;
  782. public boolean lastOnGround;
  783. public Location phaseSetback;
  784. public Location locationFromBlock;
  785. public int ticksOnGround;
  786. public int hoverVL;
  787. public int flyActions;
  788. public double lastDeltaY;
  789. public int acFailTimes;
  790. public boolean wasPistoned;
  791. public boolean pistonSlime;
  792. public int pistonTicks;
  793. public int pistonedTicks;
  794. public int speedPhaseFlags;
  795. public int acinccooldown;
  796. public int bigCPSVL;
  797. public int genericACVL;
  798. public int directionCooldown;
  799. private int acInteractions;
  800. public int epearlvl;
  801. public int blockCancelled;
  802. public int vehicleTicks;
  803. public long checkCPS;
  804. public int acTypeAleftclicks;
  805. public int acTypeArightclicks;
  806. public SmallAverageCollector acTypeACollectorRC;
  807. public SmallAverageCollector acTypeACollectorLC;
  808. public int glideFlags;
  809. public long acTypeALastPacketTime;
  810. public double acTypeAFreedomRC;
  811. public double acTypeAFreedomLC;
  812. public int acTypeBSwings;
  813. public double acTypeBSwingFullCPS;
  814. public double acTypeBVL;
  815. public double acTypeCVL;
  816. public int acTypeATotalLag;
  817. public double kaTypeAVL;
  818. public double kaTypeAFails;
  819. public double kaTypeBVL;
  820. public float kaTypeATotalYawDelta;
  821. public double kaTypeATotalTheoreticalYawDelta;
  822. public double kaTypeALastAimValue;
  823. public int kaTypeATicks;
  824. public long kaTypeALastSwingTime;
  825. public int kaTypeATicksNotMoving;
  826. public long kaTypeBLastHitTime;
  827. public float kaTypeCTotalYawDelta;
  828. public long kaTypeCLastHitTime;
  829. public double kaTypeCVL;
  830. public int kaTypeCStandingTicks;
  831. public int kaTypeDVL;
  832. public long kaTypeDLastHitTime;
  833. public long kaTypeBLastPacketTime;
  834. public double kaTypeBExcusedViolations;
  835. public double kaTypeBLastHDist;
  836. public int acTypeCLastCPS;
  837. public SmallAverageCollector combinedCollector;
  838. public long acTypeBLastHitTime;
  839.  
  840. private String color(String text)
  841. {
  842. return ChatColor.translateAlternateColorCodes('&', text);
  843. }
  844.  
  845. public void fail(String hackName, String data)
  846. {
  847. if (hackName.contains(",")) {
  848. hackName = hackName.replace(",", "%%comma%%");
  849. }
  850. if (data.contains(",")) {
  851. data = data.replace(",", "%%comma%%");
  852. }
  853. if (this.addTimer == null) {
  854. this.addTimer = new Timer();
  855. }
  856. if ((hackName.equals("Fly")) || (hackName.equals("Phase")) || (hackName.equals("Step"))) {
  857. StorageUtils.log(this.player, new SimpleDateFormat("MM/dd/yy hh:mm a").format(new Date()) + " EST," + hackName + "@");
  858. } else {
  859. StorageUtils.log(this.player, new SimpleDateFormat("MM/dd/yy hh:mm a").format(new Date()) + " EST," + hackName + " (" + data + ")@");
  860. }
  861. if (this.addTimer.hasReached(600L))
  862. {
  863. this.addTimer.reset();
  864. this.failedQueue.add(hackName + "," + data);
  865. }
  866. }
  867.  
  868. private void updateTerrain() {
  869. if (this.getWorld() == null) {
  870. return;
  871. }
  872. final boolean b = false;
  873. this.underBlock = b;
  874. this.ice = b;
  875. this.piston = b;
  876. this.slime = b;
  877. this.lava = b;
  878. this.water = b;
  879. this.vine = b;
  880. this.vehicle = b;
  881. this.ladder = b;
  882. this.web = b;
  883. this.inBlock = b;
  884. this.ground = b;
  885. for (double x = -0.3; x <= 0.3; x += 0.3) {
  886. for (double z = -0.3; z <= 0.3; z += 0.3) {
  887. final Location playerLocation = this.player.getLocation();
  888. final Material belowPlayer = playerLocation.clone().add(x, -1.0E-13, z).getBlock().getType();
  889. final Material liquidCheck = playerLocation.clone().add(x, 0.0625, z).getBlock().getType();
  890. final Material specialGround = playerLocation.clone().add(x, -0.5000000000001, z).getBlock().getType();
  891. final Material abovePlayer = playerLocation.clone().add(x, 2.2, z).getBlock().getType();
  892. if (!this.ground) {
  893. this.ground = (this.checkSolid(belowPlayer) || this.isSpecialGround(specialGround));
  894. }
  895. if (!this.web) {
  896. this.web = (belowPlayer.equals((Object)Material.WEB) || abovePlayer.equals((Object)Material.WEB));
  897. }
  898. if (!this.ladder) {
  899. this.ladder = (belowPlayer.equals((Object)Material.LADDER) || abovePlayer.equals((Object)Material.LADDER));
  900. }
  901. if (!this.vine) {
  902. this.vine = (belowPlayer.equals((Object)Material.VINE) || abovePlayer.equals((Object)Material.VINE));
  903. }
  904. if (!this.water) {
  905. this.water = (liquidCheck.equals((Object)Material.STATIONARY_WATER) || liquidCheck.equals((Object)Material.WATER) || abovePlayer.equals((Object)Material.STATIONARY_WATER) || abovePlayer.equals((Object)Material.WATER));
  906. }
  907. if (!this.lava) {
  908. this.lava = (liquidCheck.equals((Object)Material.STATIONARY_LAVA) || liquidCheck.equals((Object)Material.LAVA) || abovePlayer.equals((Object)Material.STATIONARY_LAVA) || abovePlayer.equals((Object)Material.LAVA));
  909. }
  910. if (!this.slime) {
  911. this.slime = (belowPlayer.getId() == 165);
  912. }
  913. if (!this.piston) {
  914. this.piston = (belowPlayer.equals((Object)Material.PISTON_BASE) || belowPlayer.equals((Object)Material.PISTON_EXTENSION) || belowPlayer.equals((Object)Material.PISTON_MOVING_PIECE) || belowPlayer.equals((Object)Material.PISTON_STICKY_BASE));
  915. }
  916. if (!this.ice) {
  917. this.ice = (belowPlayer.equals((Object)Material.ICE) || belowPlayer.equals((Object)Material.PACKED_ICE));
  918. }
  919. if (!this.underBlock) {
  920. this.underBlock = this.checkSolid(abovePlayer);
  921. }
  922. if (!this.inBlock) {
  923. this.inBlock = (this.checkSolid(belowPlayer) && !this.checkPhase(liquidCheck));
  924. }
  925. }
  926. }
  927. this.vehicle = (this.player.getVehicle() != null);
  928. if (this.ground) {
  929. this.blockGlitchSetbackLocation = this.getLocation();
  930. }
  931. }
  932.  
  933. public boolean checkLiquid(final Material m) {
  934. final Material[] array;
  935. final Material[] solids = array = new Material[] { Material.WATER, Material.STATIONARY_WATER, Material.LAVA, Material.STATIONARY_LAVA };
  936. for (final Material mat : array) {
  937. if (mat.equals((Object)m)) {
  938. return true;
  939. }
  940. }
  941. return m.isSolid();
  942. }
  943.  
  944. public boolean checkPhase(final Material m) {
  945. final int[] array;
  946. final int[] whitelist = array = new int[] { 355, 196, 194, 197, 195, 193, 64, 96, 187, 184, 186, 107, 185, 183, 192, 189, 139, 191, 85, 101, 190, 113, 188, 160, 102, 163, 157, 0, 145, 49, 77, 135, 108, 67, 164, 136, 114, 156, 180, 128, 143, 109, 134, 53, 126, 44, 416, 8, 425, 138, 26, 397, 372, 13, 135, 117, 108, 39, 81, 92, 71, 171, 141, 118, 144, 54, 139, 67, 127, 59, 115, 330, 164, 151, 178, 32, 28, 93, 94, 175, 122, 116, 130, 119, 120, 51, 140, 147, 154, 148, 136, 65, 10, 69, 31, 105, 114, 372, 33, 34, 36, 29, 90, 142, 27, 104, 156, 66, 40, 330, 38, 180, 149, 150, 75, 76, 55, 128, 6, 295, 323, 63, 109, 78, 88, 134, 176, 11, 9, 44, 70, 182, 83, 50, 146, 132, 131, 106, 177, 68, 8, 111, 30, 72, 53, 126, 37 };
  947. for (final int ids : array) {
  948. if (m.getId() == ids) {
  949. return true;
  950. }
  951. }
  952. return false;
  953. }
  954.  
  955. public boolean checkSolid(final Material m) {
  956. final Material[] array;
  957. final Material[] solids = array = new Material[] { Material.SNOW, Material.SNOW_BLOCK, Material.CARPET, Material.DIODE, Material.DIODE_BLOCK_OFF, Material.DIODE_BLOCK_ON, Material.REDSTONE_COMPARATOR, Material.REDSTONE_COMPARATOR_OFF, Material.REDSTONE_COMPARATOR_ON, Material.SKULL, Material.SKULL_ITEM, Material.LADDER, Material.WATER_LILY };
  958. for (final Material mat : array) {
  959. if (mat.equals((Object)m)) {
  960. return true;
  961. }
  962. }
  963. return m.isSolid();
  964. }
  965.  
  966. private boolean isSpecialGround(final Material material) {
  967. final int[] array;
  968. final int[] specialGroundIDs = array = new int[] { 85, 188, 189, 190, 191, 192, 113, 107, 183, 184, 185, 186, 187, 139, 65 };
  969. for (final int i : array) {
  970. if (i == material.getId()) {
  971. return true;
  972. }
  973. }
  974. return false;
  975. }
  976.  
  977. public String getDetectedHack() {
  978. return this.detectedHack;
  979. }
  980.  
  981. public String getDetectedHackData() {
  982. return this.detectedHackData;
  983. }
  984.  
  985. public double getLastHorizontalDistance() {
  986. if (this.lastX == 0.0 || this.lastZ == 0.0 || this.x == 0.0 || this.z == 0.0) {
  987. return 0.0;
  988. }
  989. return TrigUtils.getDistance(this.x, this.z, this.lastX, this.lastZ);
  990. }
  991.  
  992. public double getLastTargetHorizontalDistance() {
  993. if (this.getTarget() instanceof Player) {
  994. final PlayerData pd = this.api.getDataManager().getPlayerDataByPlayer((Player)this.getTarget());
  995. return pd.getLastHorizontalDistance();
  996. }
  997. return 0.28;
  998. }
  999.  
  1000. public boolean isInBlock() {
  1001. return this.inBlock;
  1002. }
  1003.  
  1004. public boolean setInBlock(final boolean inBlock) {
  1005. return this.inBlock = inBlock;
  1006. }
  1007.  
  1008. public void setWorld(final World world) {
  1009. this.currentWorld = world;
  1010. }
  1011.  
  1012. private float getLastYaw() {
  1013. return this.lastYaw;
  1014. }
  1015.  
  1016. public float getUnusedYawDelta() {
  1017. return this.yawDelta;
  1018. }
  1019.  
  1020. private void setYawDelta(final float yawDelta) {
  1021. this.yawDelta = yawDelta;
  1022. }
  1023.  
  1024. public void setCPS(final int CPS) {
  1025. this.cps = CPS;
  1026. }
  1027.  
  1028. public double getBanVL() {
  1029. return this.banVL;
  1030. }
  1031. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement