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

An randomevent which places a temporary object. More...

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

Public Member Functions

void execute ()
 A function representing the unit of work that will be carried out.
 ObjectPlacementEvent (CustomGameObject object, int delay)
 Constructs a new ObjectReplacementEvent.
 ObjectPlacementEvent (CustomGameObject object, int delay, Runnable onDestination)
 Constructs a new ObjectReplacementEvent.
void onCancel (boolean logout)
 A function executed on cancellation.
void onSchedule ()
 A function executed on registration.
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

final CustomGameObject object
 The custom game object.
final Runnable onDestination
 The runnable.

Additional Inherited Members

Protected Member Functions inherited from com.runehive.game.task.Task
void baseExecute ()
boolean canSchedule ()
 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

An randomevent which places a temporary object.

Author
Daniel | Obey

Definition at line 11 of file ObjectPlacementEvent.java.

Constructor & Destructor Documentation

◆ ObjectPlacementEvent() [1/2]

com.runehive.game.task.impl.ObjectPlacementEvent.ObjectPlacementEvent ( CustomGameObject object,
int delay )

Constructs a new ObjectReplacementEvent.

Definition at line 20 of file ObjectPlacementEvent.java.

20 {
21 this(object, delay, () -> {
22 });
23 }

References com.runehive.game.task.Task.delay, and object.

◆ ObjectPlacementEvent() [2/2]

com.runehive.game.task.impl.ObjectPlacementEvent.ObjectPlacementEvent ( CustomGameObject object,
int delay,
Runnable onDestination )

Constructs a new ObjectReplacementEvent.

Definition at line 26 of file ObjectPlacementEvent.java.

26 {
27 super(false, delay);
28 this.object = object;
29 this.onDestination = onDestination;
30 }

References com.runehive.game.task.Task.delay, object, and onDestination.

Member Function Documentation

◆ execute()

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

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

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

Definition at line 39 of file ObjectPlacementEvent.java.

39 {
40 this.cancel();
41 }

References com.runehive.game.task.Task.cancel().

Here is the call graph for this function:

◆ onCancel()

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

A function executed on cancellation.

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

Definition at line 44 of file ObjectPlacementEvent.java.

44 {
45 onDestination.run();
46
47 if (object.isRegistered()) {
48 object.unregister();
49 }
50 }

References onDestination.

◆ onSchedule()

void com.runehive.game.task.impl.ObjectPlacementEvent.onSchedule ( )

A function executed on registration.

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

Definition at line 33 of file ObjectPlacementEvent.java.

33 {
34 if (!object.isRegistered())
35 object.register();
36 }

Member Data Documentation

◆ object

final CustomGameObject com.runehive.game.task.impl.ObjectPlacementEvent.object
private

The custom game object.

Definition at line 14 of file ObjectPlacementEvent.java.

Referenced by ObjectPlacementEvent(), and ObjectPlacementEvent().

◆ onDestination

final Runnable com.runehive.game.task.impl.ObjectPlacementEvent.onDestination
private

The runnable.

Definition at line 17 of file ObjectPlacementEvent.java.

Referenced by ObjectPlacementEvent(), and onCancel().


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