Hot Restore Mechanism
Hot restore targets the currently active world, combining the usual "save -> exit -> restore -> rejoin" steps into one automated chain.
Source mapping
| Capability | Core methods/constants | Location |
|---|---|---|
| Hot restore entry | TriggerHotRestoreAsync(...) | MinecraftSavesPlugin.Restore.cs |
| Command entries | HandleRestoreCurrentLatestAsync / HandleRestoreCurrentAsync | MinecraftSavesPlugin.KnotLink.cs |
| Non-reentrancy state machine | RestoreIdle/RestoreWaitingForMod/RestoreRestoring + Interlocked.CompareExchange | MinecraftSavesPlugin.cs / MinecraftSavesPlugin.Restore.cs |
| File release waiting | WaitForWorldReleaseAsync / WaitForFileUnlockedAsync | MinecraftSavesPlugin.Restore.cs |
| Timeouts | WorldExitTimeoutMs / FileReleaseTimeoutMs / RejoinTimeoutMs | MinecraftSavesPlugin.cs |
| Player data preserve | OnBeforeRestoreFolder / OnAfterRestoreFolder | MinecraftSavesPlugin.Restore.cs |
Trigger methods
- Hotkey:
Alt+Ctrl+Z - KnotLink commands:
RESTORE_CURRENT_LATESTRESTORE_CURRENT <backup_file>
Prerequisites
- Active world can be identified (world files occupied)
- Available backups exist (latest or specified file)
- Integration mod and KnotLink are available
If any prerequisite fails, flow is cancelled with failure reason.
State machine
RestoreIdle: idle, can start restoreRestoreWaitingForMod: waiting for mod save-and-exitRestoreRestoring: performing restore
If another trigger arrives when non-idle, request is ignored and logged.
Execution flow
- Handshake (
action = restore) and check mod version - Send
pre_hot_restore, wait for save-and-exit confirmation - Wait for world release (
level.datunlock included) - Run restore (latest or specified backup)
- Send
restore_finished - Send
rejoin_world, wait for rejoin result - Broadcast
hot_restore_complete
Sequence (text)
TriggerHotRestoreAsync
-> handshake(action=restore)
-> pre_hot_restore
-> wait WORLD_SAVE_AND_EXIT_COMPLETE (10s)
-> wait world release (15s) + level.dat unlock (10s)
-> RestoreBackupAsync
-> restore_finished(status=success/failure)
-> rejoin_world
-> wait REJOIN_RESULT (30s)
-> hot_restore_complete(status=...)
Typical final states
full_success: restore + rejoin succeededrestore_ok_rejoin_failed: restore succeeded, rejoin failedrestore_ok_rejoin_timeout: restore succeeded, rejoin timed out
If early steps fail (handshake, file release, missing backup file), flow ends early with restore_cancelled or restore_finished;status=failure.
Common failure points
- Handshake timeout or incompatible mod version
- World files not released within timeout
- Specified backup file does not exist
Request/response examples
Restore latest
Request:
RESTORE_CURRENT_LATEST
Response:
OK:Hot restore triggered for 'WorldName'
Restore specified backup
Request:
RESTORE_CURRENT backup_2026-02-28_18-30-01.7z
Response:
OK:Hot restore triggered for 'WorldName' with backup 'backup_2026-02-28_18-30-01.7z'
Safety recommendations
- Run your first hot restore on a test world
- Before specified restore, run
LIST_BACKUPS_CURRENTto verify exact filename - If hot restore keeps failing, use regular restore path first
- Enable
PreservePlayerDatabefore testing player-state retention