Filled PVP Flight

Discussion in 'Archived: Plugin Requests' started by Pink__Slime, Apr 7, 2013.

  1. Offline

    Pink__Slime

    I just need a small plugin where IF you are flying and get hit it will disable flight. I am using essentials for fly and the command is /fly.

    If this could be made ASAP I would be really appreciated.
     
  2. Offline

    timtower Administrator Administrator Moderator

    To anybody who wants to compile:
    Code:
    @EventHandler
        public void event(EntityDamageEvent event) {
            Entity e = event.getEntity();
            if(e instanceof Player) {
                Player player = (Player)e;
                if(player.getAllowFlight()){
                    player.setAllowFlight(false);
                }
            }
        }
     
  3. Offline

    Pink__Slime

    timtower I'll do it, I was just too busy to actually write one myself.

    Thanks :)

    EDIT: It doesn't work... I tested it by doing /fly and getting a friend to hit me and I was still flying.
    What I need is it to disable the flight for that player.
     
  4. Offline

    timtower Administrator Administrator Moderator

    Pink__Slime Did you register the event ( maybe stupid question but happens a lot )
    And this code checks if a player is hit and it is able to fly, if so, then take him / her down. This should work with any command
     
  5. Offline

    Pink__Slime

    http://tny.cz/06ba9873

    That's my code... I've probably made some stupid mistake, just found out I made the stupidest mistake ever in another one of mine.
     
  6. Offline

    timtower Administrator Administrator Moderator

  7. Offline

    Pink__Slime

    Fixed my errors. Forgot to register it.
     
  8. Offline

    timtower Administrator Administrator Moderator

Share This Page