[Closed] How do I block/force death?

Discussion in 'Plugin Development' started by iZanax, Sep 8, 2012.

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

    iZanax

    EDIT: i came to conclusion that idea that i had in mind with this is not really efficient, so i dont need answer anymore ;)

    I want to use the foodbar as healthbar.
    For that i need to block death.
    And to set death if foodlevel == 0

    #1 I cant cancel PlayerDeathEvent
    So how can i cancel death when player's Health reaches 0?

    #2 How to force death with foodlevel==0?
    without player.setHealth(0);
     
  2. Offline

    _Waffles_

    Why cant you cancel PlayerDeathEvent?
     
  3. Offline

    TheHarofreak

    @_Waffles: Because you cant cancel it.
     
  4. Offline

    QuantumDev

    You could check whenever the player is damaged and if their health is below or equal to 0, then add half a heart?
     
  5. Offline

    iZanax

    I considerd it, but I want to look first to other options, if there are.
     
  6. Offline

    stelar7

    cancel the EntityDamageEvent if player
    use FoodLevelChangeEvent to set the hp == to the food level
     
  7. Offline

    gomeow

    Are you sure this works?
     
  8. Offline

    stelar7

    yes, I'm sure
     
Thread Status:
Not open for further replies.

Share This Page