Hello, I am currently developing a plugin and I thought several times and programmed to antifly systems, without success, for cheats could easily bypass. I look to you to give me the code it takes to do this: I will like that in every second (in one spot, it's very simple ...) to audit whether we are more than 3 blocks in height from the ground. Next, a boolean field, I like to know if the person is still at the same height or is higher. The problem is that I do not know much about the mechanism to know how tall blocks the player relative to the block. Good evening. (sorry for my poor english)
Dont really know what you want, but I'm guessing you want to know how to make an anti-fly plugin? So lets break this into steps. Find the player y co-ordinate - lets call this variable Code: PlayerY Look at the block 1 y lower than PlayerY - Code: PlayerY - 1 Is it air? Look at the block below that block. Is it a fluid? continue looping untill it's not a fluid. How many times did you loop? That is how high they are. Have a look at the Locations class in the bukkit docs: http://jd.bukkit.org/rb/doxygen/da/dac/classorg_1_1bukkit_1_1Location.html repeat, if the player is still that high then he is flying. Goodluck! Hope this helps.
@gogobebe2 TIL air and grass are fluids. Also, your method would result in people going out for a swim and people flying being indistinguishable. Don't hate on swimmers!
lol. Yeah a fluid is a substance that has no fixed shape and yields easily to external pressure; a gas or (especially) a liquid.. In physics, you can speak of air as a fluid But I just realised that you can go ontop of water lolol!
@Altarry Check the players velocity Look at this http://bukkit.org/threads/anti-flying-code.108523/#post-1400520