aboutsummaryrefslogtreecommitdiff
path: root/spark-fabric/src/main
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2020-01-11 19:30:15 +0000
committerLuck <git@lucko.me>2020-01-11 19:30:15 +0000
commit2fe79f4140011f93df1567afcc9b75fababa187e (patch)
tree2a747c3da719d061302577b9cda422fe609ab636 /spark-fabric/src/main
parent9e066d1052643b2be270b4039a102260abb41ebb (diff)
downloadspark-2fe79f4140011f93df1567afcc9b75fababa187e.tar.gz
spark-2fe79f4140011f93df1567afcc9b75fababa187e.tar.bz2
spark-2fe79f4140011f93df1567afcc9b75fababa187e.zip
Add AbstractTickCounter
Diffstat (limited to 'spark-fabric/src/main')
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickCounter.java29
1 files changed, 4 insertions, 25 deletions
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickCounter.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickCounter.java
index b189e3f..ce58dcf 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickCounter.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickCounter.java
@@ -20,35 +20,14 @@
package me.lucko.spark.fabric;
+import me.lucko.spark.common.sampler.AbstractTickCounter;
import me.lucko.spark.common.sampler.TickCounter;
-import java.util.HashSet;
-import java.util.Set;
-
-public abstract class FabricTickCounter implements TickCounter {
- private final Set<TickTask> tasks = new HashSet<>();
- private int tick = 0;
-
- public void onTick() {
- for (TickTask r : this.tasks) {
- r.onTick(this);
- }
- this.tick++;
- }
-
- @Override
- public int getCurrentTick() {
- return this.tick;
- }
-
- @Override
- public void addTickTask(TickTask runnable) {
- this.tasks.add(runnable);
- }
+public abstract class FabricTickCounter extends AbstractTickCounter implements TickCounter {
@Override
- public void removeTickTask(TickTask runnable) {
- this.tasks.remove(runnable);
+ public void onTick() {
+ super.onTick();
}
public static final class Server extends FabricTickCounter {