AntiFly

Discussion in 'Plugin Development' started by Altarry, Dec 21, 2014.

Thread Status:
Not open for further replies.
  1. 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)
     
  2. Offline

    gogobebe2

    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.
     
    Last edited: Dec 22, 2014
  3. @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!
     
    gogobebe2 likes this.
  4. Offline

    gogobebe2

    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!
     
  5. gogobebe2 likes this.
  6. Offline

    fireblast709

    @AdamQpzm Tall grass has a fixed shape, thus it is not a fluid :p.
     
    gogobebe2 likes this.
  7. Offline

    gogobebe2

    @fireblast709
    Thanks, now I know tall grass isn't a fluid haha.
     
    Skionz likes this.
  8. Offline

    Funergy

Thread Status:
Not open for further replies.

Share This Page