redirected from the order of events in bungeecord
ArcadeBoard API - Input Events
Introduction(top)The plugin offers a way to detect player input when playing a game. This can range from key presses to mouse movement.
All events are both fired with Bukkit (event handlers) and when using key/mouse listeners in your game.
Available input methods:
- Jump (space)
- Sneak (ctrl/shift)
- Up,down,left,right (W A S D)
- Num keys (1-8) or scrolling (1-9)
- Mouse left/right click
- Mouse movement (movement difference)
Key events(top)Key events are buttons that are pressed. There are two main events
KeyDown event(top)The keydown event is fired when a button is pressed. When a button is continuously pressed it will repeat the keydown event. There is an initial delay before the key down is fired again that is configured in the GameSettings of your game (game.getSettings().xxxxx) and a repeat rate.
KeyUp event(top)When the button is released the keyup event will fire.
Mouse events(top)Mouse events concern the movement of the mouse or the button clicks.
- If you want to implement the key event to move a character you need to remember a few things. For starters the keydown even may fire multiple times, meaning that you have to listen for movement and schedule that movement. If you don't you will end up with a way too sensitive character to control.
- When using the KeyUp event for movement you have to realize that the user has to keep clicking and releasing the button for it to trigger a movement.
- If you want to make something like a cookie clicker, you have to listen for the keydown event, and trigger a "click on you cookie". You also have to detect the keyup event to allow for a next keydown event.