Only generate uuid for new username strings

This commit is contained in:
crimera
2026-01-16 21:08:32 +08:00
parent d80b905879
commit 112801f220

View File

@@ -685,7 +685,7 @@ async function launchGame(playerName = 'Player', progressCallback, javaPathOverr
throw new Error(`Game client missing. Tried: ${attempted}`);
}
const uuid = uuidv4();
const uuid = getUuidForUser(playerName);
const args = [
'--app-dir', gameLatest,
'--java-exec', javaBin,
@@ -717,6 +717,21 @@ function loadUsername() {
return config.username || 'Player';
}
function getUuidForUser(username) {
const config = loadConfig();
const userUuids = config.userUuids || {};
if (userUuids[username]) {
return userUuids[username];
}
const newUuid = uuidv4();
userUuids[username] = newUuid;
saveConfig({ userUuids });
return newUuid;
}
function saveJavaPath(javaPath) {
const trimmed = (javaPath || '').trim();
saveConfig({ javaPath: trimmed });