Using correct way to register listener

This commit is contained in:
BrainStone 2018-09-01 18:01:10 +02:00
parent 8a4b23649d
commit 81992a5676
No known key found for this signature in database
GPG Key ID: 66CCC234C2CEB306

View File

@ -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