Solved Group drops beyond stack size

Discussion in 'Plugin Development' started by netolokao, May 12, 2017.

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

    netolokao

    Hello,

    I'm trying to develop a plugin to group all drops of the same type on one single ground item, is there any way to do that or is it limited to the default stack size of the item?

    Thanks
     
  2. Offline

    Zombie_Striker

    @netolokao
    You can, but its not as straight forward as setting the amount.
    1. Create a Hashmap. The keys will be Item instances and the values will be an Integer. This represents the amount of items an Item has.
    2. On PlayerPickupItemEvent
    3. Check if the item is in the event. If so, cancel the event and add the items to the inventory. Set the amount of each itemstack so that the amount equals the number from the hashmap.
     
  3. Offline

    netolokao

    Thanks for the help, it worked! :D
     
  4. Offline

    Zombie_Striker

    @netolokao
    If your problem has been solved, mark this thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page