RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.game.task.impl.AntiVenomTask Class Reference
Inheritance diagram for com.runehive.game.task.impl.AntiVenomTask:
Collaboration diagram for com.runehive.game.task.impl.AntiVenomTask:

Public Member Functions

 AntiVenomTask (Player player)
void execute ()
 A function representing the unit of work that will be carried out.
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 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

Definition at line 7 of file AntiVenomTask.java.

Constructor & Destructor Documentation

◆ AntiVenomTask()

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

Definition at line 10 of file AntiVenomTask.java.

10 {
11 super(false, 50);
12 this.player = player;
13 }

References player.

Member Function Documentation

◆ execute()

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

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

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

Definition at line 16 of file AntiVenomTask.java.

16 {
17 if (player.getVenomImmunity().get() <= 0)
18 this.cancel();
19
20 if (player.getVenomImmunity().decrementAndGet(50) <= 50)
21 player.send(new SendMessage("Your resistance to venom is about to wear off!"));
22
23 if (player.getVenomImmunity().get() <= 0)
24 cancel();
25 }

References com.runehive.game.task.Task.cancel(), com.runehive.util.MutableNumber.decrementAndGet(), com.runehive.game.world.entity.mob.player.Player.getVenomImmunity(), and player.

Here is the call graph for this function:

◆ onCancel()

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

A function executed on cancellation.

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

Definition at line 28 of file AntiVenomTask.java.

28 {
29 player.send(new SendMessage("Your resistance to venom has worn off!"));
30 player.getVenomImmunity().set(0);
31 }

References player.

Member Data Documentation

◆ player

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

Definition at line 8 of file AntiVenomTask.java.

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


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