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

Public Member Functions

 SystemUpdateEvent (int ticks)
Public Member Functions inherited from com.runehive.game.task.TickableTask
void execute ()
 A function representing the unit of work that will be carried out.
 TickableTask (boolean instant, int delay)
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.
void tick ()
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 int ticks

Static Private Attributes

static final Logger logger = LogManager.getLogger(SystemUpdateEvent.class)

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 8 of file SystemUpdateEvent.java.

Constructor & Destructor Documentation

◆ SystemUpdateEvent()

com.runehive.game.task.impl.SystemUpdateEvent.SystemUpdateEvent ( int ticks)

Definition at line 13 of file SystemUpdateEvent.java.

13 {
14 super(true, 10);
15 this.ticks = ticks;
16 }

References ticks.

Member Function Documentation

◆ onCancel()

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

A function executed on cancellation.

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

Definition at line 31 of file SystemUpdateEvent.java.

31 {
32 World.shutdown();
33 }

References com.runehive.game.world.World.shutdown().

Here is the call graph for this function:

◆ tick()

void com.runehive.game.task.impl.SystemUpdateEvent.tick ( )
protected

Reimplemented from com.runehive.game.task.TickableTask.

Definition at line 19 of file SystemUpdateEvent.java.

19 {
20 int remaining = ticks - tick * 10;
21 logger.info("Server shutdown in " + remaining + " ticks (" + remaining * 3 / 5 + " seconds)");
22
23 if (remaining == 10)
24 World.save();
25
26 if (remaining == 0)
27 cancel();
28 }

References com.runehive.game.task.Task.cancel(), logger, com.runehive.game.world.World.save(), tick(), and ticks.

Referenced by tick().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ logger

final Logger com.runehive.game.task.impl.SystemUpdateEvent.logger = LogManager.getLogger(SystemUpdateEvent.class)
staticprivate

Definition at line 10 of file SystemUpdateEvent.java.

Referenced by tick().

◆ ticks

final int com.runehive.game.task.impl.SystemUpdateEvent.ticks
private

Definition at line 11 of file SystemUpdateEvent.java.

Referenced by SystemUpdateEvent(), and tick().


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