Controlling and showing air / breath bar out of water

Discussion in 'Plugin Development' started by hmmcrunchy, Feb 3, 2015.

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

    hmmcrunchy

    HI there, ive figure out how to control and edit the amount of air a player has but is it possible to show the air bar consistently whle the player is out of the water.

    trying to use it as the thirst bar on my plugin bit like health but for water

    thanks :)
     
  2. Offline

    RenditionsRule

    I believe there is a method called getOxygenLevel and setOxygenLevel but I'll have to check the Bukkit Documentation to be sure...

    To display it, I would send a packet to the player's client saying that they are underwater, while the server prevents them from drowning.
     
  3. Offline

    hmmcrunchy

    hey rendition thanks for reply yes there is, I can set it which alters the level but it only actually work sin water as soon as you leave it disappears and resets to full

    when on land I cant seem to get it to appear at all, I did think of changing head block to water maybe but that's a lot of checks on move and also would affect the drinking of water.
     
  4. Offline

    RenditionsRule

    @hmmcrunchy Not to mention the constant event pinging. I recommend a packet based option or API such as ProtocolLib to hook into so you can send a packet telling them they're underwater, but telling the server that they aren't.

    This may however affect vision because of the translucent image pasted into the screen when underwater.
     
  5. Offline

    hmmcrunchy

    Yes that would kill performance

    Hmm yea good idea, so telling underwater but not showing it as well . I don't want much do I XD

    great idea though thanks ill take a look at protocolLib
     
Thread Status:
Not open for further replies.

Share This Page