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.
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); } } }
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.
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
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.