Solved Issues with EntityCombustEvent

Discussion in 'Plugin Development' started by maved145, Jun 27, 2017.

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

    maved145

    Trying to prevent certain items from burning in lava but having issues.

    Sometimes the event fires and sometimes it doesn't. Doesn't seem to have any sort of pattern to it.

    Code:
    @EventHandler
        public void onItemBurn(EntityCombustEvent event){
            Bukkit.broadcastMessage(event.getEntityType().toString());
           
        }
    Any ideas?
     
  2. Offline

    Zombie_Striker

    @maved145
    Try also listening to ItemDespawnEvent, as EntityCombustEvent is only triggered when the fire animation appears on an entity (which sometimes does not happen for items.)
     
    maved145 likes this.
  3. Offline

    maved145

    @Zombie_Striker How would i go about checking if the despawn was due to it burning in lava though?
     
  4. Offline

    Zombie_Striker

    @maved145
    My mistake. It seems that event only triggers if the item was on the ground for 5 minutes.

    Instead, try using EntityDamageEvent. If the cause was LAVA, FIRE, or FIRE_TICK, cancel the event.
     
    maved145 likes this.
Thread Status:
Not open for further replies.

Share This Page