Solved Set Fire Ticks caused by Fire

Discussion in 'Plugin Development' started by Jsketchy, Aug 8, 2013.

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

    Jsketchy

    How would I check to see if a player was set on fire by fire or lava, and then set their fire ticks to 80(half the usual burn time)? I've already tried:

    Code:java
    1. @EventHandler
    2. public boolean onEntityCombustEvent(EntityCombustByBlockEvent event) {
    3. final Entity victim = event.getEntity();
    4. if (victim instanceof Player) {
    5. ((Player) victim).setFireTicks(80);
    6. }
    7. return false;
    8. }


    But that doesn't reset their fire ticks. Am I missing something?
     
  2. Offline

    Jamesthatguy

    Cancel the event then manually set him on fire with the defined amount of ticks. See if that works.
     
    zachoooo likes this.
  3. Offline

    zachoooo

    This
     
  4. Offline

    Jsketchy

    Like so?

    Code:java
    1. @EventHandler
    2. public boolean onEntityCombustEvent(EntityCombustByBlockEvent event) {
    3. final Entity victim = event.getEntity();
    4. if (victim instanceof Player) {
    5. event.setCancelled(true);
    6. ((Player) victim).setFireTicks(80);
    7. }
    8. return false;
    9. }
     
  5. Offline

    zachoooo

    Yes, I'm pretty sure its supposed to be public void, but I don't know if it matters...
     
Thread Status:
Not open for further replies.

Share This Page