RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.game.task.impl.MessageEvent Class Reference

Sends game messages to all the online players. More...

Inheritance diagram for com.runehive.game.task.impl.MessageEvent:
Collaboration diagram for com.runehive.game.task.impl.MessageEvent:

Public Member Functions

void execute ()
 A function representing the unit of work that will be carried out.
 MessageEvent ()
 Constructs a new MessageEvent.
Public Member Functions inherited from com.runehive.game.task.Task
Task attach (Object newKey)
 Attaches a new key.
synchronized final void cancel ()
 Cancels all subsequent executions.
synchronized final void cancel (boolean logout)
 Cancels all subsequent executions.
boolean canRun ()
 Determines if the task can be ran.
Optional< Object > getAttachment ()
String getCreationStackTraceStr ()
int getDelay ()
Long getElapsedTimeFromRunStartTime ()
Optional< Long > getRunStartTime ()
long getTaskCreationTime ()
String getTaskId ()
boolean isInstant ()
boolean isRunning ()
void setDelay (int delay)
 Sets the cyclic delay.
void setExecutionTime ()
 Task (boolean instant, int delay)
 Creates a new Task.
 Task (int delay)
 Creates a new Task that doesn't execute instantly.

Private Attributes

int tick
 The message randomevent ticks.

Additional Inherited Members

Protected Member Functions inherited from com.runehive.game.task.Task
void baseExecute ()
boolean canSchedule ()
 A function executed on registration.
void onCancel (boolean logout)
 A function executed on cancellation.
void onSchedule ()
 A function executed on registration.
Package Functions inherited from com.runehive.game.task.Task
void onException (Exception e)
 A function executed on thrown exceptions.
void onLoop ()
 A function executed when iterated over.
final synchronized void process ()
synchronized void setRunning (boolean running)

Detailed Description

Sends game messages to all the online players.

Author
Daniel

Definition at line 14 of file MessageEvent.java.

Constructor & Destructor Documentation

◆ MessageEvent()

com.runehive.game.task.impl.MessageEvent.MessageEvent ( )

Constructs a new MessageEvent.

Definition at line 20 of file MessageEvent.java.

20 {
21 super(180);
22 this.tick = 0;
23 }

Member Function Documentation

◆ execute()

void com.runehive.game.task.impl.MessageEvent.execute ( )

A function representing the unit of work that will be carried out.

Reimplemented from com.runehive.game.task.Task.

Definition at line 26 of file MessageEvent.java.

26 {
27 tick++;
28
29 if (tick % 2 == 0) {
30 String message = Utility.randomElement(Config.MESSAGES);
31 World.sendMessage("<img=15> <col=2C7526>Broadcast: </col>" + message);
32 } else {
33 TriviaBot.assign();
34 }
35 }

References com.runehive.content.triviabot.TriviaBot.assign(), com.runehive.Config.MESSAGES, com.runehive.util.Utility.randomElement(), com.runehive.game.world.World.sendMessage(), and tick.

Here is the call graph for this function:

Member Data Documentation

◆ tick

int com.runehive.game.task.impl.MessageEvent.tick
private

The message randomevent ticks.

Definition at line 17 of file MessageEvent.java.

Referenced by execute().


The documentation for this class was generated from the following file: