Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. package fr.anticheat.checks.movement.Fly;
  2.  
  3. import fr.anticheat.AntiCheat;
  4. import fr.anticheat.checks.*;
  5. import fr.anticheat.data.PlayerData;
  6. import fr.anticheat.utils.*;
  7. import net.minecraft.server.v1_8_R3.Packet;
  8. import net.minecraft.server.v1_8_R3.PacketPlayInFlying;
  9. import org.bukkit.*;
  10. import org.bukkit.entity.Player;
  11.  
  12. public class FlyB extends MovementCheck {
  13. public int upcount = 0;
  14. public int neutral = 0;
  15. public int Hop = 0;
  16.  
  17. public FlyB() {
  18. super("Fly (B)", "FlyB");
  19. this.setMaxVl(5);
  20. }
  21.  
  22. @Override
  23. public void handleCheck(Player player, PlayerData playerData, PlayerLocation from, PlayerLocation to) {
  24. // player.sendMessage("" + (to.getY() - from.getY()) + " " + (player.isOnGround()));
  25. if (!(player.getVehicle() != null || player.isFlying() || playerData.getTeleportTicks() <= playerData.getPingTicks() || playerData.getVelocityTicks() <= playerData.getPingTicks() * 2 || !playerData.isSpawnedIn() || playerData.hasLag() || playerData.hasFast())) {
  26. World world = player.getWorld();
  27. Cuboid cuboid = new Cuboid(playerData.getLocation()).add(new Cuboid(-0.5, 0.5, 0.0, 1.5, -0.5, 0.5));
  28. if (cuboid.checkBlocks(world, type -> !MaterialList.BAD_VELOCITY.contains((Object) type))) {
  29. if (to.getY() - from.getY() == 0.164773281826065) {
  30. upcount = 0;
  31. }
  32. if (to.getY() - from.getY() == 0.1647732818260721) {
  33. upcount = 0;
  34. }
  35. if (to.getY() - from.getY() > 0) {
  36. if (!player.isOnGround()) {
  37. upcount++;
  38. // player.sendMessage("Count" + upcount);
  39. // player.sendMessage("" + ChatColor.BLUE + upcount);
  40. if (upcount > 4) {
  41. // player.sendMessage("Count");
  42. AntiCheat.getInstance().getAlertsManager().handleViolation(playerData, this, String.valueOf((to.getY() - from.getY())), 0.8);
  43. }
  44. else {
  45. if (upcount > 2) {
  46. Hop++;
  47. // player.sendMessage("Hop" + ChatColor.BLUE + Hop);
  48. if (Hop > 2) {
  49. // player.sendMessage("Hop" + ChatColor.LIGHT_PURPLE + Hop);
  50. AntiCheat.getInstance().getAlertsManager().handleViolation(playerData, this, String.valueOf((to.getY() - from.getY())), 0.8);
  51. }
  52. }
  53. }
  54. }
  55. else {
  56. upcount = 0;
  57. }
  58. } else {
  59. if (upcount >= 2) {
  60. upcount = upcount - 2;
  61. neutral = 0;
  62. // player.sendMessage("" + ChatColor.RED + upcount);
  63. } else {
  64. if (upcount == 1) {
  65. upcount = upcount - 1;
  66. neutral++;
  67. if (neutral > 3) {
  68. // player.sendMessage("Neutral");
  69. AntiCheat.getInstance().getAlertsManager().handleViolation(playerData, this, String.valueOf((to.getY() - from.getY())), 0.8);
  70. }
  71. }
  72. }
  73. }
  74. } else {
  75. neutral = 0;
  76. upcount = 0;
  77. Hop = 0;
  78. this.violations -= Math.min(this.violations + 2.5, 0.01);
  79. }
  80. }
  81. else {
  82. upcount = 0;
  83. neutral = 0;
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement