Package com.epicbot.api.shared.methods
Interface IKeyboardAPI
-
public interface IKeyboardAPI
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
getKeyState(int keyCode)
Gets the key state of the given key.java.util.List<java.lang.Integer>
getPressedKeys()
Gets all keys currently pressed down.void
holdKey(int keyCode, int time)
Hold a key for an amount of time.void
holdKey(int keyCode, int time, boolean async)
Hold a key for an amount of time.void
holdKey(int keyCode, int maxTime, boolean async, Completable completable)
Hold a key for a maximum amount of time or until the givenCompletable
is done.void
holdKey(int keyCode, int maxTime, Completable completable)
Hold a key for a maximum amount of time or until the givenCompletable
is done.void
pressKey(int keyCode)
void
releaseKey(int keyCode)
void
sendKey(int keyCode)
Send a key press and release event for the given key.void
sendKey(int keyCode, boolean async)
Send a key press and release event for the given key.void
sendText(java.lang.String text, boolean pressEnter)
Sends key events to type the given text.void
sendText(java.lang.String text, boolean pressEnter, boolean async)
Sends key events to type the given text.void
typeKey(int keyCode)
-
-
-
Method Detail
-
getKeyState
boolean getKeyState(int keyCode)
Gets the key state of the given key.- Parameters:
keyCode
- the key code (seeKeyEvent
)- Returns:
- true if the key is pressed, false otherwise
-
getPressedKeys
java.util.List<java.lang.Integer> getPressedKeys()
Gets all keys currently pressed down.- Returns:
- list of key codes (see
KeyEvent
)
-
sendKey
void sendKey(int keyCode)
Send a key press and release event for the given key.- Parameters:
keyCode
- the key code (seeKeyEvent
)
-
sendKey
void sendKey(int keyCode, boolean async)
Send a key press and release event for the given key.- Parameters:
keyCode
- the key code (seeKeyEvent
)async
- whether to wait until the key is sent
-
sendText
void sendText(java.lang.String text, boolean pressEnter)
Sends key events to type the given text.- Parameters:
text
- the text to typepressEnter
- true to press the enter key afterwards, false otherwise
-
sendText
void sendText(java.lang.String text, boolean pressEnter, boolean async)
Sends key events to type the given text.- Parameters:
text
- the text to typepressEnter
- true to press the enter key afterwards, false otherwiseasync
- whether to wait until all the keys are sent
-
holdKey
void holdKey(int keyCode, int time)
Hold a key for an amount of time.- Parameters:
keyCode
- the key code (seeKeyEvent
)time
- the time to hold the key for
-
holdKey
void holdKey(int keyCode, int time, boolean async)
Hold a key for an amount of time.- Parameters:
keyCode
- the key code (seeKeyEvent
)time
- the time to hold the key forasync
- whether to wait until all the keys are sent
-
holdKey
void holdKey(int keyCode, int maxTime, Completable completable)
Hold a key for a maximum amount of time or until the givenCompletable
is done.- Parameters:
keyCode
- the key code (seeKeyEvent
)maxTime
- the maxiumum time to hold the key forcompletable
- key will be hold untilCompletable.isDone()
returns true
-
holdKey
void holdKey(int keyCode, int maxTime, boolean async, Completable completable)
Hold a key for a maximum amount of time or until the givenCompletable
is done.- Parameters:
keyCode
- the key code (seeKeyEvent
)maxTime
- the maxiumum time to hold the key forasync
- whether to wait until all the keys are sentcompletable
- key will be hold untilCompletable.isDone()
returns true
-
pressKey
void pressKey(int keyCode)
-
releaseKey
void releaseKey(int keyCode)
-
typeKey
void typeKey(int keyCode)
-
-