Class KeyboardEvent
- java.lang.Object
-
- org.dreambot.api.input.event.AbstractEvent
-
- org.dreambot.api.input.event.impl.keyboard.KeyboardEvent
-
- All Implemented Interfaces:
java.lang.Runnable
public class KeyboardEvent extends AbstractEvent
Event to handle typing messages on the keyboard Uses the implementation ofKeyboard.getKeyboardTypingAlgorithm()
Automatically stops if script is stopped or paused when no random solver is active. Has a built-in timeout of message#length seconds.
-
-
Constructor Summary
Constructors Constructor Description KeyboardEvent(java.lang.String message, boolean enter, Condition stop)
KeyboardEvent(Key key, boolean enter, Condition stop)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Condition
completed()
Condition to determine if this event has completedboolean
equals(java.lang.Object o)
Condition
failed()
Condition to determine if this event has failed.Key
getKey()
java.lang.Object
getKEYBOARD_LOCK()
java.lang.String
getMessage()
Condition
getStop()
int
hashCode()
boolean
isCompleted()
boolean
isEnter()
boolean
isOutOfTime()
void
run()
Runs this keyboard event Adjusts the message by the return value ofKeyboardTypingAlgorithm.handleTyping(String)
on each iterative call Will run until the stop condition is met, it's completed, or it times out.void
setCompleted(boolean completed)
void
setEnter(boolean enter)
void
setKey(Key key)
void
setMessage(java.lang.String message)
void
setOutOfTime(boolean outOfTime)
void
setStop(Condition stop)
java.lang.String
toString()
-
-
-
Method Detail
-
completed
public Condition completed()
Condition to determine if this event has completed- Specified by:
completed
in classAbstractEvent
- Returns:
- Condition to check if message successfully typed or event is marked as completed
-
failed
public Condition failed()
Condition to determine if this event has failed.- Specified by:
failed
in classAbstractEvent
- Returns:
- Condition for if the stop condition is met or the event has timed out and the message has not yet been completed.
-
run
public void run()
Runs this keyboard event Adjusts the message by the return value ofKeyboardTypingAlgorithm.handleTyping(String)
on each iterative call Will run until the stop condition is met, it's completed, or it times out. Will press enter if the message is typed successfully and enter is set to true
-
getMessage
public java.lang.String getMessage()
-
getKey
public Key getKey()
-
isEnter
public boolean isEnter()
-
getStop
public Condition getStop()
-
isOutOfTime
public boolean isOutOfTime()
-
isCompleted
public boolean isCompleted()
-
getKEYBOARD_LOCK
public java.lang.Object getKEYBOARD_LOCK()
-
setMessage
public void setMessage(java.lang.String message)
-
setKey
public void setKey(Key key)
-
setEnter
public void setEnter(boolean enter)
-
setStop
public void setStop(Condition stop)
-
setOutOfTime
public void setOutOfTime(boolean outOfTime)
-
setCompleted
public void setCompleted(boolean completed)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-