Manually drowning a player

Discussion in 'Plugin Development' started by dark navi, Apr 9, 2012.

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

    dark navi

    Hey guys, I wanted to manually make a player drown on dry-land, but I can't seem to get it to work.

    I am setting it using:
    Code:
    a.getKey().setRemainingAir(a.getValue() / 100 * 3);
    a.getValue() returns a number from 0-100.

    I think it is failing because the user is not underwater and it is replenishing his air every tick. Anyone know how to stop this?


    EDIT: Ok, so I got it to set the air correctly, but is there a way to make the air bubbles appear when the player ISN'T in the water? I would assume so...
     
  2. Offline

    Technius

    You could try setting up a repeated task reduces the player's air level every tick.
     
  3. Offline

    dark navi

    Sorry, I suppose I wasn't clear enough. It is altering the breath level, but it isn't displaying the bubbles unless the player is actually underwater.
     
  4. Offline

    Father Of Time

    First off, the only reason I entered this post was due to the hilarity of the title, I got this mental image of someone forcing someones head into a toilet bowl... ;)

    However, regarding your EDIT note:

    From my understanding this sadly is one of those particle animations that aren't triggerable client side. Some particles just occur naturally when certian game conditions are met in the client and do not require verification from the server, such as the purple particles around nether portals. I'm sure its possible with some hard work like anything is, but as far as a build in ability to do this in the bukkit api, none exist.

    Take care!
     
    dark navi likes this.
  5. Offline

    dark navi

    Alright! Thanks for the info. :)
     
  6. Offline

    biel

    Has anyone found the way to display the bubbles while in land?
    Edit: I've thinked about maybe sending a block of water in the players head using player.getEyeLocation()
     
Thread Status:
Not open for further replies.

Share This Page