ConanServerManager/lib/structs/SessionData.dart
zontreck da7b56ad97 Attempt to fix a problem where a mod update might fail post-restart.
NOTE: Moves the jail folder where the mods folder used to be. The Jail folder is then recreated after the next restart.
2025-03-02 19:36:18 -07:00

54 lines
1.7 KiB
Dart

import 'package:libac_dart/utils/TimeUtils.dart';
import 'package:servermanager/statemachine.dart';
class SessionData {
static bool shutdownPending = false;
/// This flag will track the number of seconds until restart
///
/// This is initialized initially based on the AutomaticRestart timer if enabled.
///
/// This may be updated to one to two minutes by a Mod Update, or Wrapper update
static Time timer = Time(hours: 0, minutes: 0, seconds: 0);
static Time operating_time = Time(hours: 0, minutes: 0, seconds: 0);
static String shutdownMessage = "";
static WarnIntervals CURRENT_INTERVAL = WarnIntervals.NONE;
static Time mod_update_check_tracker = Time(hours: 0, minutes: 0, seconds: 0);
static bool enableRestartTimer = false;
static bool canPingServer = false;
static bool isWorldRestore = false;
static String snapshotToRestore =
""; // This is the absolute path to the snapshot being restored
static Time timeSinceLastPing = Time(hours: 0, minutes: 0, seconds: 0);
static void resetModUpdateChecker() {
mod_update_check_tracker = Time(hours: 0, minutes: 0, seconds: 0);
}
static void bumpModUpdateChecker() {
mod_update_check_tracker.tickUp();
}
static bool shouldCheckModUpdates() {
return mod_update_check_tracker.minutes >= 30;
}
/// Interactive Editor - Snapshots
///
/// This contains the list of snapshot files for the editor client GUI.
///
/// DO NOT USE ON SERVER
///
/// Use the [Settings.getWorldSnapshotFiles] function instead
static List<String> IE_SNAPSHOTS = [];
static bool IS_FIRST_MOD_CHECK = true;
static ShutDownReason shutDownReason = ShutDownReason.NORMAL;
}
enum ShutDownReason { MODS, NORMAL }