public abstract class Event extends MethodProvider
Modifier and Type | Class and Description |
---|---|
static class |
Event.EventMode
The event mode determines the execution environment under which the event gets executed under.
|
static class |
Event.EventStatus
The event status determines what the event is doing.
|
bank, bot, camera, chatbox, client, colorPicker, combat, configs, depositBox, dialogues, diaries, display, doorHandler, equipment, experienceTracker, favour, grandExchange, graphicObjects, groundItems, hintArrow, inventory, keyboard, logger, logoutTab, magic, map, menu, mouse, npcs, objects, players, prayer, projectiles, quests, settings, skills, store, tabs, trade, walking, widgets, worlds
Constructor and Description |
---|
Event() |
Modifier and Type | Method and Description |
---|---|
void |
addChild(Event event)
Adds a child to this event.
|
MethodProvider |
exchangeContext(Bot bot)
This class and method can be used to create extensions to the API with
full direct access to the OSBot 2 API within your extensions.
|
abstract int |
execute()
This is the execution method.
|
java.util.LinkedList<Event> |
getChildren()
Gets the children events of this event.
|
Event.EventMode |
getMode()
Gets the
Event.EventMode of this event. |
Event |
getParent()
Gets the parent event of this event.
|
Event.EventStatus |
getStatus()
Gets the
Event.EventStatus of this event. |
boolean |
hasFailed()
Determines if the event has the status
Event.EventStatus.FAILED . |
boolean |
hasFinished()
Determines if the event has the status
Event.EventStatus.FINISHED . |
void |
interrupt()
Interrupts the event's executing thread.
|
boolean |
isQueued()
Determines if the event has the status
Event.EventStatus.QUEUED . |
boolean |
isWorking()
Determines if the event has the status
Event.EventStatus.WORKING . |
void |
onEnd()
Called after this event is executed.
|
void |
onStart()
Called before this event is executed.
|
void |
removeChild(Event event)
Removes a child from this event.
|
Event |
setAsync()
Sets the event mode to
Event.EventMode.ASYNC . |
Event |
setBlocking()
Sets the event mode to
Event.EventMode.BLOCKING . |
Event |
setFailed()
Sets the status of this event to
Event.EventStatus.FAILED . |
Event |
setFinished()
Sets the status of this event to (@link Event.EventStatus#FINISHED}.
|
void |
setParent(Event parent)
Sets the parant event of this event.
|
execute, getBank, getBot, getCamera, getChatbox, getClient, getColorPicker, getCombat, getConfigs, getDepositBox, getDialogues, getDiaries, getDisplay, getDoorHandler, getEquipment, getExperienceTracker, getFavour, getGrandExchange, getGraphicObjects, getGroundItems, getHintArrow, getInventory, getKeyboard, getLogoutTab, getMagic, getMap, getMenuAPI, getMouse, getNpcs, getObjects, getPlayers, getPrayer, getProjectiles, getQuests, getSettings, getSkills, getStore, getTabs, getTrade, getWalking, getWidgets, getWorlds, gRandom, gRandom, gRandom, initializeContext, log, log, myPlayer, myPosition, random, random, sleep, stripFormatting, warn
public Event getParent()
public void setParent(Event parent)
parent
- The parent eventpublic java.util.LinkedList<Event> getChildren()
public void addChild(Event event)
event
- The event to add.public void removeChild(Event event)
event
- The event to remove.public Event.EventStatus getStatus()
Event.EventStatus
of this event.Event.EventStatus
of this event.public Event.EventMode getMode()
Event.EventMode
of this event.Event.EventMode
of this event.public Event setBlocking()
Event.EventMode.BLOCKING
.public Event setAsync()
Event.EventMode.ASYNC
.public void onStart() throws java.lang.InterruptedException
java.lang.InterruptedException
- Thrown when execution is interruptedpublic void onEnd() throws java.lang.InterruptedException
java.lang.InterruptedException
- Thrown when execution is interruptedpublic abstract int execute() throws java.lang.InterruptedException
onLoop()
in OSBot v1.java.lang.InterruptedException
- Thrown when execution is interruptedpublic boolean hasFinished()
Event.EventStatus.FINISHED
.Event.EventStatus.FINISHED
.public boolean hasFailed()
Event.EventStatus.FAILED
.Event.EventStatus.FAILED
.public boolean isWorking()
Event.EventStatus.WORKING
.Event.EventStatus.WORKING
.public boolean isQueued()
Event.EventStatus.QUEUED
.Event.EventStatus.QUEUED
.public Event setFailed()
Event.EventStatus.FAILED
.public Event setFinished()
public void interrupt()
public MethodProvider exchangeContext(Bot bot)
exchangeContext
in class MethodProvider
bot
- The Bot
instance.