From 81992a5676b2209a81941804f1837eebdd76e159 Mon Sep 17 00:00:00 2001 From: BrainStone Date: Sat, 1 Sep 2018 18:01:10 +0200 Subject: [PATCH] Using correct way to register listener --- .../plan/system/tasks/SpongeTaskSystem.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/SpongeTaskSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/SpongeTaskSystem.java index 9b13ed881..05ab2d0f7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/SpongeTaskSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/SpongeTaskSystem.java @@ -18,15 +18,11 @@ public class SpongeTaskSystem extends ServerTaskSystem { @Override public void enable() { super.enable(); - try { - PingCountTimerSponge pingCountTimer = new PingCountTimerSponge(); - Sponge.getEventManager().registerListeners(plugin, pingCountTimer); - long startDelay = TimeAmount.SECOND.ticks() * (long) Settings.PING_SERVER_ENABLE_DELAY.getNumber(); - RunnableFactory.createNew("PingCountTimer", pingCountTimer) - .runTaskTimer(startDelay, PingCountTimerSponge.PING_INTERVAL); - } catch (ExceptionInInitializerError | NoClassDefFoundError ignore) { - // Running CraftBukkit - } + PingCountTimerSponge pingCountTimer = new PingCountTimerSponge(); + ((PlanSponge) plugin).registerListener(pingCountTimer); + long startDelay = TimeAmount.SECOND.ticks() * (long) Settings.PING_SERVER_ENABLE_DELAY.getNumber(); + RunnableFactory.createNew("PingCountTimer", pingCountTimer) + .runTaskTimer(startDelay, PingCountTimerSponge.PING_INTERVAL); } @Override