Jump to content
×
×
  • Create New...

Source anti Fly


Recommended Posts

  • Bot

Bonjour,

 

je vous partage un anti-fly que j'ai un peu modifié.

 

Source :

public class Fly implements Listener {

   private Main main;
   public Fly(Main main) {
       this.main = main;
   }
  
   @EventHandler
   public void onMove(PlayerMoveEvent event) {
       final Player player = event.getPlayer();
       if(main.getConfig().getBoolean("hacks.fly")) {
           if(player.hasPermission(Permission.FLY_BYPASS))
               if(player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {return;}
           if(player.isFlying()) {return;}
           if(event.isCancelled()) {return;}
           if(player.getLocation().subtract(0, 1, 0).getBlock().getType() == Material.LAVA ||player.getLocation().subtract(0, 1, 0).getBlock().getType() == Material.WATER || player.getLocation().subtract(0, 1, 0).getBlock().getType() == Material.STATIONARY_LAVA || player.getLocation().subtract(0, 1, 0).getBlock().getType() == Material.STATIONARY_WATER) {return;}
           if(player.getLocation().subtract(0, 1, 0).getBlock().getType() == Material.AIR) {
               final Location loc = player.getLocation();
               Bukkit.getScheduler().runTaskLater(Main.getPlugin(), new Runnable() {
                   @Override
                   public void run() {
                       if(player.getLocation().getY() >= loc.getY()) {
                           if(fly.containsKey(player.getName())) {
                               fly.put(player.getName(), fly.get(player.getName())+1);
                           }
                           else {
                               fly.put(player.getName(), 1);
                           }
                           if(fly.get(player.getName()) > 10) {
                               Alerter alert = Alerter.getInstance();
                               alert.alertHack(player, HackType.FLY, fly.get(player.getName()));
                           }
                           if(fly.get(player.getName()) > 20) {
                               AutoBan.getInstance().autobanPlayer(player, 15, HackType.FLY);
                           }
                       }
                   }
               }, 20);
           } else{
               if(fly.containsKey(player.getName())) {
                   if(fly.get(player.getName()) == 1) {
                       fly.remove(player.getName());
                   } else if(fly.get(player.getName()) == 0) {
                       fly.remove(player.getName());
                   } else {
                       fly.put(player.getName(), fly.get(player.getName())-1);
                   }
               }
           }
       }
   }
  
   private Map fly = new HashMap<>();

   public void remove() {
       for(String hack : fly.keySet()) {
           fly.remove(hack);
       }
   }
}

Faites en un plugin, vous pouvez le modifié

 

Source original du code : Kioz.

 

 

Cordialement, Takuma.

090100logo.png 090149logo-4-bis.png

Link to comment
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.