mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-21 12:12:50 +02:00
[#772] Fix ShutdownHook registration
This solves session saving on server shutdown, as previous solution has proven to work just fine.
This commit is contained in:
parent
a68fde3e9e
commit
48ccd6d099
|
@ -17,6 +17,7 @@
|
|||
package com.djrapitops.plan.system.tasks;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.ShutdownHook;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
||||
|
@ -40,12 +41,14 @@ import java.util.concurrent.TimeUnit;
|
|||
public class BukkitTaskSystem extends ServerTaskSystem {
|
||||
|
||||
private final Plan plugin;
|
||||
private final ShutdownHook shutdownHook;
|
||||
private final PingCountTimerBukkit pingCountTimer;
|
||||
|
||||
@Inject
|
||||
public BukkitTaskSystem(
|
||||
Plan plugin,
|
||||
PlanConfig config,
|
||||
ShutdownHook shutdownHook,
|
||||
RunnableFactory runnableFactory,
|
||||
PaperTPSCountTimer paperTPSCountTimer,
|
||||
BukkitTPSCountTimer bukkitTPSCountTimer,
|
||||
|
@ -64,6 +67,7 @@ public class BukkitTaskSystem extends ServerTaskSystem {
|
|||
logsFolderCleanTask,
|
||||
playersPageRefreshTask);
|
||||
this.plugin = plugin;
|
||||
this.shutdownHook = shutdownHook;
|
||||
this.pingCountTimer = pingCountTimer;
|
||||
}
|
||||
|
||||
|
@ -78,6 +82,7 @@ public class BukkitTaskSystem extends ServerTaskSystem {
|
|||
} catch (ExceptionInInitializerError | NoClassDefFoundError ignore) {
|
||||
// Running CraftBukkit
|
||||
}
|
||||
shutdownHook.register();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package com.djrapitops.plan.system.tasks;
|
||||
|
||||
import com.djrapitops.plan.PlanSponge;
|
||||
import com.djrapitops.plan.ShutdownHook;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
||||
|
@ -34,12 +35,14 @@ import java.util.concurrent.TimeUnit;
|
|||
public class SpongeTaskSystem extends ServerTaskSystem {
|
||||
|
||||
private final PlanSponge plugin;
|
||||
private final ShutdownHook shutdownHook;
|
||||
private final PingCountTimerSponge pingCountTimer;
|
||||
|
||||
@Inject
|
||||
public SpongeTaskSystem(
|
||||
PlanSponge plugin,
|
||||
PlanConfig config,
|
||||
ShutdownHook shutdownHook,
|
||||
RunnableFactory runnableFactory,
|
||||
SpongeTPSCountTimer spongeTPSCountTimer,
|
||||
BootAnalysisTask bootAnalysisTask,
|
||||
|
@ -57,6 +60,7 @@ public class SpongeTaskSystem extends ServerTaskSystem {
|
|||
logsFolderCleanTask,
|
||||
playersPageRefreshTask);
|
||||
this.plugin = plugin;
|
||||
this.shutdownHook = shutdownHook;
|
||||
this.pingCountTimer = pingCountTimer;
|
||||
}
|
||||
|
||||
|
@ -68,6 +72,8 @@ public class SpongeTaskSystem extends ServerTaskSystem {
|
|||
long startDelay = TimeAmount.toTicks(config.getNumber(Settings.PING_SERVER_ENABLE_DELAY), TimeUnit.SECONDS);
|
||||
runnableFactory.create("PingCountTimer", pingCountTimer)
|
||||
.runTaskTimer(startDelay, PingCountTimerSponge.PING_INTERVAL);
|
||||
|
||||
shutdownHook.register();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user