finish implementation
This commit is contained in:
parent
a17e0452a0
commit
23d93a7f9a
8 changed files with 90 additions and 55 deletions
|
@ -289,26 +289,33 @@ class C2SUploadSettingsPacket implements IPacket {
|
|||
@override
|
||||
Future<PacketResponse> handleServerPacket() async {
|
||||
Settings settings = Settings();
|
||||
settings.deserialize(srvSettings);
|
||||
settings.Write();
|
||||
|
||||
// Check if server is running, if not, stop immediately
|
||||
// If server is running, schedule restart for 1 minute and send a alert to all players, then perform stop or restart depending on if running in Pterodactyl Compatibility mode
|
||||
SessionData.shutdownMessage = "Server wrapper updated. Restart required.";
|
||||
SessionData.timer.apply(60);
|
||||
SessionData.CURRENT_INTERVAL = WarnIntervals.NONE;
|
||||
CompoundTag currentSettings = settings.serialize();
|
||||
try {
|
||||
settings.deserialize(srvSettings);
|
||||
settings.Write();
|
||||
|
||||
if (settings.subsys.currentState == States.Inactive) {
|
||||
Timer.periodic(Duration(seconds: 10), (timer) {
|
||||
SessionData.shutdownPending = true;
|
||||
// Stop packet server
|
||||
PacketServer.socket!.close();
|
||||
timer.cancel();
|
||||
exit(0);
|
||||
}); // We give time to allow the server to shut down gracefully.
|
||||
// Check if server is running, if not, stop immediately
|
||||
// If server is running, schedule restart for 1 minute and send a alert to all players, then perform stop or restart depending on if running in Pterodactyl Compatibility mode
|
||||
SessionData.shutdownMessage = "Server wrapper updated. Restart required.";
|
||||
SessionData.timer.apply(60);
|
||||
SessionData.CURRENT_INTERVAL = WarnIntervals.NONE;
|
||||
|
||||
if (settings.subsys.currentState == States.Inactive) {
|
||||
Timer.periodic(Duration(seconds: 10), (timer) {
|
||||
SessionData.shutdownPending = true;
|
||||
// Stop packet server
|
||||
PacketServer.socket!.close();
|
||||
timer.cancel();
|
||||
exit(0);
|
||||
}); // We give time to allow the server to shut down gracefully.
|
||||
}
|
||||
|
||||
return PacketResponse.nil;
|
||||
} catch (E) {
|
||||
settings.deserialize(currentSettings);
|
||||
return PacketResponse.nil;
|
||||
}
|
||||
|
||||
return PacketResponse.nil;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue