Packet to drop an item for a specific Player

Discussion in 'Plugin Development' started by nathanthesnooper, Oct 28, 2017.

Thread Status:
Not open for further replies.
  1. I have a generator for a plugin that generates ore, and I want it to generate faster. However, if there are two players both in the generator, the items are distributed to the one with better ping.

    I want to distribute it evenly, so each client has different items on the ground

    All help appreciated!
     
  2. Offline

    Zombie_Striker

    @nathanthesnooper
    If you care about players getting the items equally, you should not do item drops. Instead, it should just be a give-away for all players online. (I'm assuming this about item drops, since the term "generator" is too generic)
     
  3. @Zombie_Striker The "generator" is a block you stand on that generates ore (Item). When 2+ people stand on it, it generates faster accordingly. However, the items dropped all go to the player with less ping, giving them an advantage.

    I want to have the animation of it on the ground. I have resorted to cancelling the pickup item event for the player with the most ping for certain items, but I do not know how to disable item merging.

    EDIT: I think what I'm going to do is set the item's lore to the uuid of the player I want the item to go to.
     
  4. Offline

    Side8StarLite

    @nathanthesnooper
    Just an idea, but maybe you can drop the item, set the pickup delay to MAX_INTEGER so the item doesn't actually get picked up, and after a few ticks remove it if it is within a range of a player. In terms of actually giving it to the player, maybe you can add the item directly to the inventory. Just a thought...
     
  5. @nathanthesnooper
    If I think what your trying to do, what you could do is have a PlayerPickupItemEvent, and when the player picks up an item in a certain range, it checks for other players around them and add it to their inventory as well.
     
Thread Status:
Not open for further replies.

Share This Page