Solved Item Drop going away on explosion

Discussion in 'Plugin Development' started by Pugmatt, Aug 11, 2014.

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

    Pugmatt

    Hi, I've been having a bit of an issue with Item Drops.
    I want to cancel Item Drops disappearing when they're near an explosion, and I had solved this before with this:
    Code:java
    1. @EventHandler
    2. public void itemHit(EntityDamageEvent event) {
    3. if(event.getEntity() instanceof Item) {
    4. event.setCancelled(true);
    5. }
    6. }

    Now on 1.7.10 it is not working. I've tried this as well now:
    Code:java
    1.  
    2. @EventHandler(priority=EventPriority.HIGHEST)
    3. public void onDespawn(ItemDespawnEvent event) {
    4. event.setCancelled(true);
    5. }

    None of these seem to work, and no errors appear. Any help?

    Thanks,
    Pugmatt
     
  2. Offline

    ZodiacTheories

    Pugmatt

    Your second one will lag the server alot.
     
  3. ZodiacTheories
    I'm pretty sure that was just an example to show it didn't work....
    But Pugmatt , that won't work because the item isn't despawning, it's being destroyed. Have you tried the entityDeath event?
     
  4. Offline

    Pugmatt

Thread Status:
Not open for further replies.

Share This Page