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

This randomevent handles the teleblock counter. More...

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

Public Member Functions

 TeleblockTask (Player player)
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.

Protected Member Functions

void execute ()
 A function representing the unit of work that will be carried out.
void onCancel (boolean logout)
 A function executed on cancellation.
Protected Member Functions inherited from com.runehive.game.task.Task
void baseExecute ()
boolean canSchedule ()
 A function executed on registration.
void onSchedule ()
 A function executed on registration.

Private Attributes

final Player player

Additional Inherited Members

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

This randomevent handles the teleblock counter.

Author
Daniel | Obey

Definition at line 13 of file TeleblockTask.java.

Constructor & Destructor Documentation

◆ TeleblockTask()

com.runehive.game.task.impl.TeleblockTask.TeleblockTask ( Player player)

Definition at line 17 of file TeleblockTask.java.

17 {
18 super(false, 0);
19 this.player = player;
20 }

References player.

Member Function Documentation

◆ execute()

void com.runehive.game.task.impl.TeleblockTask.execute ( )
protected

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

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

Definition at line 23 of file TeleblockTask.java.

23 {
24 if (player == null || !player.isValid()) {
25 cancel();
26 return;
27 }
28
29 if (player.teleblockTimer.decrementAndGet() <= 0) {
30 cancel();
31 }
32 }

References com.runehive.game.task.Task.cancel(), and player.

Here is the call graph for this function:

◆ onCancel()

void com.runehive.game.task.impl.TeleblockTask.onCancel ( boolean logout)
protected

A function executed on cancellation.

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

Definition at line 35 of file TeleblockTask.java.

35 {
36 player.send(new SendWidget(SendWidget.WidgetType.TELEBLOCK, 0));
37 player.send(new SendMessage("You feel the effects of the tele-block spell go away."));
38 }

References player, and com.runehive.net.packet.out.SendWidget.WidgetType.TELEBLOCK.

Member Data Documentation

◆ player

final Player com.runehive.game.task.impl.TeleblockTask.player
private

Definition at line 15 of file TeleblockTask.java.

Referenced by execute(), onCancel(), and TeleblockTask().


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