How to tell if a player is holding down right click.

Discussion in 'Spigot Plugin Development' started by black_, Jun 7, 2017.

  1. What the title asks. Anyway to tell if a player is holding down rightclick?
     
  2. You could listen to player interact event(s) and check the server tick time and store it in a hashmap for each player. Compare the tick times for any skipped ticks. Skipped ticks should represent they let go of right click. Consecutive ticks means they're either holding it or spam clicking 20+ times a second.

    Best I can think of at least.
     
  3. For right click that could work, but for 1.8 pvp servers that wont work for left click, because 20cps is common in the pvp community ;)

    As for the OP, currenty dont have acces to my laptop so I cant help you out there
     
  4. Hmm, I think I understand. Can you expand a bit on the hashmap.
     
  5. I think you should check the ticks between interact events when you hold the button and when you spamming it. It will tell you when a player hold or spam.