diff options
Diffstat (limited to 'spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitTickCounter.java')
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitTickCounter.java | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitTickCounter.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitTickCounter.java index 44a69cb..2a71257 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitTickCounter.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitTickCounter.java @@ -20,30 +20,22 @@ package me.lucko.spark.bukkit; +import me.lucko.spark.common.sampler.AbstractTickCounter; import me.lucko.spark.common.sampler.TickCounter; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitTask; -import java.util.HashSet; -import java.util.Set; - -public class BukkitTickCounter implements TickCounter, Runnable { +public class BukkitTickCounter extends AbstractTickCounter implements TickCounter, Runnable { private final Plugin plugin; private BukkitTask task; - private final Set<TickTask> tasks = new HashSet<>(); - private int tick = 0; - public BukkitTickCounter(Plugin plugin) { this.plugin = plugin; } @Override public void run() { - for (TickTask r : this.tasks) { - r.onTick(this); - } - this.tick++; + onTick(); } @Override @@ -56,18 +48,4 @@ public class BukkitTickCounter implements TickCounter, Runnable { this.task.cancel(); } - @Override - public int getCurrentTick() { - return this.tick; - } - - @Override - public void addTickTask(TickTask runnable) { - this.tasks.add(runnable); - } - - @Override - public void removeTickTask(TickTask runnable) { - this.tasks.remove(runnable); - } } |