How to monitor player press a number key?

Discussion in 'Spigot Help' started by BearJW233, May 30, 2017.

  1. Depends on which situation you to do check it. Are you in an inventory? (I guess so)
    Give us some code, so we can try to help you

    EDIT: If the player does not have anything in his hand, the event is not fired
  2. it isn't in an inventory, I just want to do a fast skills casting by press key, hypxel has similar functions some games
  3. I think the player must have an item in their Hotbar when swapping otherwise, the event is not fired. I'm not 100% certain about that though
  4. OK......... maybe spigot doesn't have such a evnet.. The Evnet PlayerSwapHandItemsEvent 's
    description is::
    Called when a player swap items between main hand and off hand using the hotkey
  5. Ops, my mistake. You need to use PlayerItemHeldEvent
  6. Oh, thanks!! BTW, How to set player's chosen hotbar?