No need for a cast

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

View File

@ -11,15 +11,18 @@ import org.spongepowered.api.scheduler.Task;
public class SpongeTaskSystem extends ServerTaskSystem { public class SpongeTaskSystem extends ServerTaskSystem {
private final PlanSponge plugin;
public SpongeTaskSystem(PlanSponge plugin) { public SpongeTaskSystem(PlanSponge plugin) {
super(plugin, new SpongeTPSCountTimer(plugin)); super(plugin, new SpongeTPSCountTimer(plugin));
this.plugin = plugin;
} }
@Override @Override
public void enable() { public void enable() {
super.enable(); super.enable();
PingCountTimerSponge pingCountTimer = new PingCountTimerSponge(); PingCountTimerSponge pingCountTimer = new PingCountTimerSponge();
((PlanSponge) plugin).registerListener(pingCountTimer); plugin.registerListener(pingCountTimer);
long startDelay = TimeAmount.SECOND.ticks() * (long) Settings.PING_SERVER_ENABLE_DELAY.getNumber(); long startDelay = TimeAmount.SECOND.ticks() * (long) Settings.PING_SERVER_ENABLE_DELAY.getNumber();
RunnableFactory.createNew("PingCountTimer", pingCountTimer) RunnableFactory.createNew("PingCountTimer", pingCountTimer)
.runTaskTimer(startDelay, PingCountTimerSponge.PING_INTERVAL); .runTaskTimer(startDelay, PingCountTimerSponge.PING_INTERVAL);