API Request - ItemBurnEvent

Discussion in 'Plugin Development' started by AmoebaMan, Jul 7, 2012.

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

    AmoebaMan

    I'm currently polishing off a CTF plugin for my automated event server. However, there's one small problem. I currently have it such that de-spawning flags will be returned to their chests. However, one of my maps has a lava river, and I find that if flags are dropped into and destroyed in it, they will not respawn. I have tried many times to find a way to combat this, but there doesn't seem to be an event that triggers when an Item entity takes damage or dies.

    Please add this? Or if I'm missing something obvious please let me know.
     
  2. Offline

    TnT

    Moved to the correct forum. Its better to ask if you're doing something wrong first, than assuming there is a missing API.

    You're previous post requesting a fix is a mistake in your logic as well.
     
    ZeusAllMighty11 likes this.
  3. Offline

    ZeusAllMighty11

    Hm....What I'm thinking is:

    check when item drop event is red wool or blue wool.
    If it is, cancel the burn event...OR if that doesn't work, just let the item burn and give it back to the player who had it. Or turn off fire damage in your server.
     
  4. Offline

    Sir Savary

    EntityCombustEvent
    get the entity and see if it an instanceof Item, simple as that
    TnT I believe this thread can be closed
     
    ferrybig likes this.
  5. Offline

    feildmaster

    That doesn't work for Items.
     
  6. Offline

    Jogy34

    Is there any way to do this. I've been looking for this too
     
  7. you can do if the item is not been found for 10 secor something, do item.remove and spawn a new 1 inside the chest
     
  8. Do I smell a bug here? Item == Entity so either you should fix that or rename the event to something like MobCombustEvent, LivingEntityCombustEvent, ...
     
  9. Offline

    feildmaster

    There are HUGE limits on various events, because of how many times they get thrown. We throw most Entity events on living entities, which is why other entities sometimes end up with their own variants of events...
     
  10. Offline

    Father Of Time

    Actually this is pretty simple, I had to do it for a "showcase" style plugin I made.

    Fire is damage, entities can take damage; hence, make a "EntityDamageEvent" and check if the DamageType is FIRE, if the damage type is fire cancel the event and take your desired action (aka, respawn).

    As of 1.2.5 RC 4 I can say with certianty that when an item drops to the ground and is set on fire (which is what lava does) that it deals EntityDamage, and that EntityDamage is what ultimately "kills" the item, despawning it; so if you simple stop the damage it won't despawn.

    I hope this helps, let us know if you run into problems. :D
     
  11. If they end up with their own variant, why not split it so they really have their own variant?
    Example: A LivingEntityCombustEvent which is cancelable, but also a EntityCombustEvent which is not cancelable. You could make the LivingEntity*Event a subclass of the Entity*Events, like this:
    public LivingEntityCombustEvent extends EntityCombustEvent implements Cancelable
    You do something similar with EntityDamageEvent and EventyDamageByEntityEvent, so why not here?
     
  12. Offline

    feildmaster

    EntityDamageEvent/EntityDamageByEntityEvent != EntityDamageEvent/ItemBurnEvent

    By variants I mean ItemSpawnEvent and CreatureSpawnEvent. These are variants that currently exist, even though they should be the same event... (EntitySpawnEvent)
     
Thread Status:
Not open for further replies.

Share This Page