aboutsummaryrefslogtreecommitdiff
path: root/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java
diff options
context:
space:
mode:
Diffstat (limited to 'spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java')
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java
index edeeb50..0eca719 100644
--- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java
+++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java
@@ -130,6 +130,21 @@ public class BukkitSparkPlugin extends JavaPlugin implements SparkPlugin {
@Override
public TickCounter createTickCounter() {
- return new BukkitTickCounter(this);
+ if (classExists("com.destroystokyo.paper.event.server.ServerTickStartEvent")) {
+ getLogger().info("Using Paper ServerTickStartEvent for tick monitoring");
+ return new PaperTickCounter(this);
+ } else {
+ getLogger().info("Using Bukkit scheduler for tick monitoring");
+ return new BukkitTickCounter(this);
+ }
+ }
+
+ private static boolean classExists(String className) {
+ try {
+ Class.forName(className);
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
}
}