Is there an event for when a player gets an item?

Discussion in 'Plugin Development' started by Tacodude, Jun 1, 2020.

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

    Tacodude

    I need a way to detect every time a player gets an item. The ideal solution should include things like picking items off of the floor, crafting items, taking items out of chests and receiving items from other plugins (like buying things from the auction house).
    I want to do this as I'm implementing a custom achievement system, and want to check if the achievement conditions are met each time the player gets an item.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Tacodude When they get it or when they have it?
    You could check the inventory every ... ticks.
     
  3. Offline

    Tacodude

    Checking their inventory every n ticks was the solution I was avoiding, but it would work. I was hoping for an event but if that doesn't exist I guess that's the solution I'll have to go for. I guess I'll go for a hybrid, checking the inventory every 300 ticks or so and also checking every PlayerPickupItemEvent and player inventory related event.
     
  4. Offline

    KarimAKL

    @Callum | NorthernH They already know about the event, they were asking for a way to check for a player receiving an item in any way, including Player#getInventory()#addItem(ItemStack...).
     
    Tacodude likes this.
Thread Status:
Not open for further replies.

Share This Page