Anti-Flying code?

Discussion in 'Plugin Development' started by Builder4Free, Oct 31, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Builder4Free

    I am making my server, it is Hunger Games themed. The whole idea of the server is for every plugin to be made by me and my friend. Me and my friend coded the current plugins ourselves. We were trying to make our own small "NoCheat" like plugin to stop Speed Hacking and Fly Hacking. Currently we are having a very difficult time. We came up with a few methods but none of them worked 100%. If anyone has any ideas on how to properly stop flying and stop speed hacking please reply.

    Also, some other things that may help us:

    The exact value at which a player jumps without modifications / jump potion.

    The exact value at which a player sprints and walks with modifications / speed potions.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  2. Offline

    ZeusAllMighty11 Retired Staff

    Why don't you log these yourself? Helps you learn.

    Also, I don't see the problem? You are just asking for code?

    nope.avi
     
  3. Offline

    GodzOfMadness

    haha i agree nope.avi

    Builder4Free show us some code to prove that you are trying im sure alot of people will be glad
    to help you on what you got so far
     
  4. Offline

    gamerzap

    Me and my freinds are doing that too :/ (Except I'm doing ALL the plugins).

    For no speed, if you could find a player's default movement speed, you could check them for potions and then check to see if their speed is higher than it should be.

    As for no fly, that's more complicated. You could see if their in the air and their y-velocity is >= 0.
     
  5. Offline

    Milkywayz

    I would just save the hassle and use a plugin like AntiCheat, I don't think I could do any better which I why I use it. There isn't any shame in using others plugins, I don't understand why people think they must have custom coding plugins for their server, unless they(you) are experienced with making plugins your server is better off with released plugins. This does not mean you should not stop trying, but plugins which would require tons of time like a LWC, Anticheat, worldguard variant is usually a waste of time since you spend a day coding the core then get stuck on something and give up, just my opinion.
     
  6. Offline

    Woobie

    Builder4Free
    Code:
    @EventHandler
    public void onMove(PlayerMoveEvent e){
      if(e.getPlayer().isFlying()){
        if(!(e.getPlayer().hasPermission("ilike.poop"))){
          e.setCancelled(true);
          Bukkit.getServer().broadcastMessage(e.getPlayer().getName()+" is pooping hard")));
     
    flyingtacoz likes this.
  7. Offline

    Cirno

    Won't work; isFlying is for creative flying if I remember. Easily bypassed with zombe's or similar.
     
  8. Offline

    Woobie

    Well on move, check block relative down, then if(!(block == true)){ cancel event
    Super pseudo :D

    EDIT: Forget it. That would disable jumping and falling :p
     
  9. Offline

    TerraVale

    LucasEmanuel likes this.
  10. Offline

    Builder4Free

    @ZeusAllMighty11 @GodzOfMadness
    Code:
                Vector vec = new Vector(to.getX(), to.getY(), to.getZ());
               
                double i = vec.distance(new Vector(from.getX(), from.getY(), from.getZ()));
                if(!player.isSprinting()){
     
                    if(i > .23){
                   
                        event.setCancelled(true);
                   
                    }
               
                }else{
                   
                    if(i > .48){
                       
                        event.setCancelled(true);
                   
                    }
                   
                }
    For all you guys saying I am just asking for code. I am clearly making an attempt. I just lack an understanding of the correct values to use.

    That's in the PlayerMoveEvent, btw.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  11. Offline

    Icyene

    Ah, its been so long since I've seen that link. Thanks for bringing it up!
     
    TerraVale likes this.
Thread Status:
Not open for further replies.

Share This Page