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;
|
package com.djrapitops.plan.system.tasks;
|
||||||
|
|
||||||
import com.djrapitops.plan.Plan;
|
import com.djrapitops.plan.Plan;
|
||||||
|
import com.djrapitops.plan.ShutdownHook;
|
||||||
import com.djrapitops.plan.system.settings.Settings;
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
||||||
|
@ -40,12 +41,14 @@ import java.util.concurrent.TimeUnit;
|
||||||
public class BukkitTaskSystem extends ServerTaskSystem {
|
public class BukkitTaskSystem extends ServerTaskSystem {
|
||||||
|
|
||||||
private final Plan plugin;
|
private final Plan plugin;
|
||||||
|
private final ShutdownHook shutdownHook;
|
||||||
private final PingCountTimerBukkit pingCountTimer;
|
private final PingCountTimerBukkit pingCountTimer;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BukkitTaskSystem(
|
public BukkitTaskSystem(
|
||||||
Plan plugin,
|
Plan plugin,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
|
ShutdownHook shutdownHook,
|
||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
PaperTPSCountTimer paperTPSCountTimer,
|
PaperTPSCountTimer paperTPSCountTimer,
|
||||||
BukkitTPSCountTimer bukkitTPSCountTimer,
|
BukkitTPSCountTimer bukkitTPSCountTimer,
|
||||||
|
@ -64,6 +67,7 @@ public class BukkitTaskSystem extends ServerTaskSystem {
|
||||||
logsFolderCleanTask,
|
logsFolderCleanTask,
|
||||||
playersPageRefreshTask);
|
playersPageRefreshTask);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.shutdownHook = shutdownHook;
|
||||||
this.pingCountTimer = pingCountTimer;
|
this.pingCountTimer = pingCountTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +82,7 @@ public class BukkitTaskSystem extends ServerTaskSystem {
|
||||||
} catch (ExceptionInInitializerError | NoClassDefFoundError ignore) {
|
} catch (ExceptionInInitializerError | NoClassDefFoundError ignore) {
|
||||||
// Running CraftBukkit
|
// Running CraftBukkit
|
||||||
}
|
}
|
||||||
|
shutdownHook.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package com.djrapitops.plan.system.tasks;
|
package com.djrapitops.plan.system.tasks;
|
||||||
|
|
||||||
import com.djrapitops.plan.PlanSponge;
|
import com.djrapitops.plan.PlanSponge;
|
||||||
|
import com.djrapitops.plan.ShutdownHook;
|
||||||
import com.djrapitops.plan.system.settings.Settings;
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
||||||
|
@ -34,12 +35,14 @@ import java.util.concurrent.TimeUnit;
|
||||||
public class SpongeTaskSystem extends ServerTaskSystem {
|
public class SpongeTaskSystem extends ServerTaskSystem {
|
||||||
|
|
||||||
private final PlanSponge plugin;
|
private final PlanSponge plugin;
|
||||||
|
private final ShutdownHook shutdownHook;
|
||||||
private final PingCountTimerSponge pingCountTimer;
|
private final PingCountTimerSponge pingCountTimer;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SpongeTaskSystem(
|
public SpongeTaskSystem(
|
||||||
PlanSponge plugin,
|
PlanSponge plugin,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
|
ShutdownHook shutdownHook,
|
||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
SpongeTPSCountTimer spongeTPSCountTimer,
|
SpongeTPSCountTimer spongeTPSCountTimer,
|
||||||
BootAnalysisTask bootAnalysisTask,
|
BootAnalysisTask bootAnalysisTask,
|
||||||
|
@ -57,6 +60,7 @@ public class SpongeTaskSystem extends ServerTaskSystem {
|
||||||
logsFolderCleanTask,
|
logsFolderCleanTask,
|
||||||
playersPageRefreshTask);
|
playersPageRefreshTask);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.shutdownHook = shutdownHook;
|
||||||
this.pingCountTimer = pingCountTimer;
|
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);
|
long startDelay = TimeAmount.toTicks(config.getNumber(Settings.PING_SERVER_ENABLE_DELAY), TimeUnit.SECONDS);
|
||||||
runnableFactory.create("PingCountTimer", pingCountTimer)
|
runnableFactory.create("PingCountTimer", pingCountTimer)
|
||||||
.runTaskTimer(startDelay, PingCountTimerSponge.PING_INTERVAL);
|
.runTaskTimer(startDelay, PingCountTimerSponge.PING_INTERVAL);
|
||||||
|
|
||||||
|
shutdownHook.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user