Fix CraftBukkit failing to initialize if some Spigot classes are present

This commit is contained in:
Rsl1122 2018-08-12 12:13:57 +03:00
parent 2dd8dd3ee1
commit f28420d4af

View File

@ -30,11 +30,13 @@ public class BukkitTaskSystem extends ServerTaskSystem {
@Override @Override
public void enable() { public void enable() {
super.enable(); super.enable();
if (Check.isSpigotAvailable()) { try {
PingCountTimer pingCountTimer = new PingCountTimer(); PingCountTimer pingCountTimer = new PingCountTimer();
((Plan) plugin).registerListener(pingCountTimer); ((Plan) plugin).registerListener(pingCountTimer);
RunnableFactory.createNew("PingCountTimer", pingCountTimer) RunnableFactory.createNew("PingCountTimer", pingCountTimer)
.runTaskTimer(20L, PingCountTimer.PING_INTERVAL); .runTaskTimer(20L, PingCountTimer.PING_INTERVAL);
} catch (ExceptionInInitializerError | NoClassDefFoundError ignore) {
// Running CraftBukkit
} }
} }