[SOLVED] Delete stack from PlayerItemPickup

Discussion in 'Spigot Plugin Development' started by Kieranlington, Jul 8, 2015.

  1. For a plugin of which I am currently developing, I have needed to cancel the usual pickup event and replace it manually. I can successfully add the item to the player's inventory; however I am struggling to find a method of accurately deleting the specific item stack, within the event, from the world.
    I don't believe any code posting is a necessity for this; however if it helps then I will.
    I have tried the following methods:
    Code (Java):
    player.getWorld().getNearbyEntities(player.getLocation(), 1, 1, 1).remove(event.getItem().getStack());
    Code (Java):
    Both without any luck.
    Does anyone have any ideas?
  2. Try
    Code (Text):
    • Winner Winner x 1
  3. @KieranOM Try to use a method for this, don't use an event for this.
    • Useful Useful x 1
  4. Thank you @jakubzz you just made me facepalm the hardest I have in a long time. I can't believe how blatantly obvious this was! I knew I was overthinking it! Thank you again!