Solved [1.9.4] Using /give Commands gives you one more Item than specified if using specific Plugins

Discussion in 'Spigot Plugin Development' started by ZockerAxel, May 19, 2016.

  1. If I try to use the /give command like
    Code (Text):
    /give @p diamond_sword 1 0
    it gives me 2 Diamond Swords, if I do
    Code (Text):
    /give @p diamond_sword 2 0
    it ives me 3 ones.

    Somehow this does only happen on the Server with my custom plugins on it.
    I'm cancelling the following Events (might be useful to tell what's the problem):
    - EntityDamageEvent
    - InventoryClickEvent
    - PlayerSwapHandItemsEvent
    - PlayerDropItemEvent
    - FoodLevelChangeEvent
    - PlayerInteractEvent

    Thanks in advance <3

    Solved by either using /replaceitem instead of /give
    OR by not using PlayerDropItemEvent
    #1 ZockerAxel, May 19, 2016
    Last edited: May 19, 2016
  2. whats the extra 0 for?
  3. it's the data value, which is used by wool color etc, not neccessary, but hey, why not xD
  4. does it still give you one more when you dont supply a data value
  5. yes it does
  6. Note to bypass command from other plugins you can call /minecraft:give ... This doesn't really solve the issue at the source, but just thought I would mention it.
    • Useful Useful x 1
  7. i only got my own plugins on my server, i only got the vanilla give command
  8. You have no other plugin providing a give command? Hmm.
  9. and even testing it with /minecraft:give , it still gives me one more than needed
  10. Remove all ur plugins to a different folder and see if it still gives the erorr, then slowly add all ur plugins back one by one untill you find the culprit.
    • Agree Agree x 1
  11. Try removing all plugins until you find the one causing the problem, then if you show us the source of the problematic plugin, or at least the relevant sections of code, I am sure someone here can help you.
  12. i know which plugin is causing it and i posted all events, i cancelled in the first post
  13. That's just not enough information, but its possible the problem could be with the PlayerDropItemEvent.
    • Winner Winner x 1
  14. Have you tried no 1 or 2?
  15. Thank god, it worked, thank you very much for your help,
    the question is now, how should i then deny the players to drop items????
  16. All your doing for that event is just canceling it? "event.setCanceled(true)" ?
  17. yes, i only test if the player is in lobby-mode and if he is in lobby mode its cancelled
    and i don't get why giving a player an item, calls an PlayerDropItemEvent ...
  18. I'm guessing minecraft's give command makes the player drop the item at their location without them actually having the item in their inventory and setting the drop delay to 0, also making them be the only one able to pick the item up.
    • Agree Agree x 2
  19. hmm....
    and how should i no exactly disallow the players from throwing out items themselves ...
  20. Or just override the minecraft give command