Solved Drop items sharing algorithm

Discussion in 'Spigot Plugin Development' started by iO_5, Jun 25, 2018.

  1. I wrote one afternoon and failed.

    I want to implement the party of the mcmmo plugin
    items share.

    A player picks drop items and randomly assigns or evenly distributes the item.
    How to do?
  2. getRemaining()?
  3. PlayerPickupItemEvent will be fired uppon an item of X amount being picked up. The amount can be either (full) 16 or 64 as far as I'm aware. Simply check if the amount is not 1 then cancel the event, remove the item and afterwards loop through all the parties and give them an amount of itemAmount/patyMembers. You should keep the remaining amount each loop and not use the first values so as to avoid giving more items than there is available.
  4. Praya


    I have plugin to share drop item based on damage dealt, want to use it?
  5. I found a better way. Thank you for your reply.
  6. Sharing the solution and marking the thread as solved would be useful for other users with the same issue.
  7. My method is a bit stupid, a bit long.:)
  8. Doesn't matter much. It'll still be useful. Well, I'm not forcing you to share it, however it would be valuable for many.
    • Agree Agree x 1