Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.anticheat.checks.movement.Fly;
- import fr.anticheat.AntiCheat;
- import fr.anticheat.checks.*;
- import fr.anticheat.data.PlayerData;
- import fr.anticheat.utils.*;
- import net.minecraft.server.v1_8_R3.Packet;
- import net.minecraft.server.v1_8_R3.PacketPlayInFlying;
- import org.bukkit.*;
- import org.bukkit.entity.Player;
- public class FlyB extends MovementCheck {
- public int upcount = 0;
- public int neutral = 0;
- public int Hop = 0;
- public FlyB() {
- super("Fly (B)", "FlyB");
- this.setMaxVl(5);
- }
- @Override
- public void handleCheck(Player player, PlayerData playerData, PlayerLocation from, PlayerLocation to) {
- // player.sendMessage("" + (to.getY() - from.getY()) + " " + (player.isOnGround()));
- if (!(player.getVehicle() != null || player.isFlying() || playerData.getTeleportTicks() <= playerData.getPingTicks() || playerData.getVelocityTicks() <= playerData.getPingTicks() * 2 || !playerData.isSpawnedIn() || playerData.hasLag() || playerData.hasFast())) {
- World world = player.getWorld();
- Cuboid cuboid = new Cuboid(playerData.getLocation()).add(new Cuboid(-0.5, 0.5, 0.0, 1.5, -0.5, 0.5));
- if (cuboid.checkBlocks(world, type -> !MaterialList.BAD_VELOCITY.contains((Object) type))) {
- if (to.getY() - from.getY() == 0.164773281826065) {
- upcount = 0;
- }
- if (to.getY() - from.getY() == 0.1647732818260721) {
- upcount = 0;
- }
- if (to.getY() - from.getY() > 0) {
- if (!player.isOnGround()) {
- upcount++;
- // player.sendMessage("Count" + upcount);
- // player.sendMessage("" + ChatColor.BLUE + upcount);
- if (upcount > 4) {
- // player.sendMessage("Count");
- AntiCheat.getInstance().getAlertsManager().handleViolation(playerData, this, String.valueOf((to.getY() - from.getY())), 0.8);
- }
- else {
- if (upcount > 2) {
- Hop++;
- // player.sendMessage("Hop" + ChatColor.BLUE + Hop);
- if (Hop > 2) {
- // player.sendMessage("Hop" + ChatColor.LIGHT_PURPLE + Hop);
- AntiCheat.getInstance().getAlertsManager().handleViolation(playerData, this, String.valueOf((to.getY() - from.getY())), 0.8);
- }
- }
- }
- }
- else {
- upcount = 0;
- }
- } else {
- if (upcount >= 2) {
- upcount = upcount - 2;
- neutral = 0;
- // player.sendMessage("" + ChatColor.RED + upcount);
- } else {
- if (upcount == 1) {
- upcount = upcount - 1;
- neutral++;
- if (neutral > 3) {
- // player.sendMessage("Neutral");
- AntiCheat.getInstance().getAlertsManager().handleViolation(playerData, this, String.valueOf((to.getY() - from.getY())), 0.8);
- }
- }
- }
- }
- } else {
- neutral = 0;
- upcount = 0;
- Hop = 0;
- this.violations -= Math.min(this.violations + 2.5, 0.01);
- }
- }
- else {
- upcount = 0;
- neutral = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement