Solved Reducing fire damage "per second"

Discussion in 'Plugin Development' started by MightyOne, Oct 19, 2017.

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

    MightyOne

    Hello guys,

    I was trying to make a Chestplate (Goron Tunic from Zelda) that would simply reduce the times a player gets damaged by fire/lava.
    So my idea was to store how many times a player gets damaged by fire in a Hashmap(UUID not player). Later I would cancel the EntityDamageEvent (if cause == FIRE / LAVA) in 3 of 4 times so the player recieves less damage. But sadly cancelling the event just caused fire to damage the player many times more per seconds. So my HasMap was not so useful.

    I tried to set the Player#setMaximumNoDamageTicks() to 10 or so to make him/her invulnerable for half a second (like in normal fire) but the fire kept damaging repeatedly anayway.

    Does anybody got an idea how to solve this problem?
    Thanks in andvance, MightyOne

    EDIT
    Maybe I could give the player a fire resistance potion for 1 sec or 2

    Yep that works quiet fine. Maybe just delete this thread, except it could be useful for others
     
    Last edited: Oct 19, 2017
  2. Offline

    Zombie_Striker

    @MightyOne
    Instead of doing raw-attempts checks for the fire damage, try storing the last time the player was damaged by fire. If the time between the last damage for fire was less than __ seconds, cancel the event.
     
  3. Offline

    MightyOne

Thread Status:
Not open for further replies.

Share This Page