Keep accepting uploads from instances without epochs

A host running the plugin from before epochs never sends one, so after
an import or delete every upload it made was discarded while the
instance believed it succeeded. The Lua now always sends its epoch, and
an upload without one is compared by generation against the stored
data the way it was before, taking over the stored epoch. Those hosts
can still overwrite an import with a copy they failed to upload, which
the README now says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-17 19:12:46 +00:00
1 parent 2529683c2b
commit 5634651de1
5 files changed
+48 -5

No files matched your search

+8 -1
View File
@@ -199,9 +199,16 @@ export default async function(context: ControllerPluginContext) {
acquiredPlayers.delete(playerName);
let stored = storedVersion(playerName);
if (playerData.epoch === undefined) {
// Instances from before epochs were added never send one, they keep the rules they had before
stored.generation = playerDatastore.get(playerName)?.generation ?? 0;
if (stored.epoch) {
playerData.epoch = stored.epoch;
}
}
if (store && (playerData.epoch ?? 0) !== stored.epoch) {
logger.warn(
`${instanceName} uploaded ${playerName} from epoch ${playerData.epoch ?? 0} while the stored ` +
`${instanceName} uploaded ${playerName} from epoch ${playerData.epoch} while the stored ` +
`epoch is ${stored.epoch}, discarding the outdated copy`
);
store = false;