Solved Prevent player to outsmart InventoryClickEvent

Discussion in 'Spigot Plugin Development' started by He-light, Mar 8, 2020.

Thread Status:
Not open for further replies.
  1. Hi, I programmed a system where players have requirements to hold a specific item in the main Hand ( for example: Player level). My problem begins now, when I check, when the player places items from the cursor to a new slot. If this slot is the players Mainhand, it cancels the action.
    But,
    if the player is fast enought, to pickup the item and place it really quickly in the mainhand slot, minecraft does not call the InventoryClickEvent and the action goes right through my requirements check. If the player does it slowly (the time between the pickup and placing of the item is approximately longer than 500ms) it is fine and the action gets cancelled, if the player has not fulfilled the requirements.

    Any suggestions?
     
  2. It'd be helpful if you could post your code here so we could see what was going on. However, Minecraft wouldn't just miss an InventoryClickEvent. It could be a visual glitch, or you might be slightly moving your mouse when you click quickly and firing off an InventoryDragEvent instead. It could even just be a bug in your code; it's hard to tell without seeing the source code.
     
  3. i just tested it and it semms that you are right and mc calls the InventoryDragEvent. Thank you for the quick response and the quick solution^^
     
Thread Status:
Not open for further replies.