hold Key
Holds a key while the stopping condition returns false. Will send KEY_PRESSED while being held. If keyChar != KeyEvent.CHAR_UNDEFINED, KEY_TYPED will also be sent. KEY_RELEASED is sent after the stopping condition returns true.
This method uses key holding delay and repeat rates which are unique to every different botter (character randomization). Delay and repeat rates mimic the 'Keyboard Properties' of the Windows Control Panel (the machine's OS doesn't matter though).
The stopping condition is checked every millisecond. Try to make sure the stopping condition doesn't take longer than 2ms to check. If it does, the method will be less human-like.
Parameters
The character to type/press. Use KeyEvent.CHAR_UNDEFINED to not send KEY_TYPED events.
The key code.
The stopping condition. The bot will continue holding the key as long as the condition returns false. Once it returns true, the bot will stop holding the key.