refactor/god-class-decomposition #17

Merged
NotEvil merged 2 commits from refactor/god-class-decomposition into develop 2026-04-16 12:38:56 +00:00
2 changed files with 11 additions and 2 deletions
Showing only changes of commit 27c86bc831 - Show all commits

View File

@@ -113,6 +113,14 @@ public class PrisonerManager extends SavedData {
return laborRecords.computeIfAbsent(playerId, id -> new LaborRecord());
}
/**
* Get labor record only if one exists. Does not create ghost entries.
*/
@Nullable
public LaborRecord getLaborRecordIfExists(UUID playerId) {
return laborRecords.get(playerId);
}
/**
* Set the labor record for a player.
*/

View File

@@ -94,8 +94,9 @@ public class EscapeMonitorService {
);
// Step 1: Save guard ID BEFORE state transition (manager.escape() removes the LaborRecord)
LaborRecord laborBeforeEscape = manager.getLaborRecord(playerId);
UUID guardId = laborBeforeEscape.getGuardId();
// Use direct map lookup to avoid creating ghost LaborRecord entries for non-WORKING prisoners
LaborRecord laborBeforeEscape = manager.getLaborRecordIfExists(playerId);
UUID guardId = laborBeforeEscape != null ? laborBeforeEscape.getGuardId() : null;
// Step 2: Transition prisoner state to FREE
boolean stateChanged = manager.escape(playerId, currentTime, reason);