mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 08:39:17 +00:00
Add a tick counter that updates on every World pulse
This commit is contained in:
@@ -66,6 +66,11 @@ public final class World {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A counter for the number of ticks ran.
|
||||||
|
*/
|
||||||
|
private long tickCounter = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The logger for this class.
|
* The logger for this class.
|
||||||
*/
|
*/
|
||||||
@@ -208,6 +213,15 @@ public final class World {
|
|||||||
return releaseNumber;
|
return releaseNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current value of the {@link #tickCounter} (the number of ticks since the game started).
|
||||||
|
*
|
||||||
|
* @return The current value of the tick counter;
|
||||||
|
*/
|
||||||
|
public long tick() {
|
||||||
|
return tickCounter;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the world by loading definitions from the specified file
|
* Initialises the world by loading definitions from the specified file
|
||||||
* system.
|
* system.
|
||||||
@@ -277,6 +291,7 @@ public final class World {
|
|||||||
unregisterNpcs();
|
unregisterNpcs();
|
||||||
registerNpcs();
|
registerNpcs();
|
||||||
scheduler.pulse();
|
scheduler.pulse();
|
||||||
|
tickCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user