Fix Hytale player detection with correct log patterns
All checks were successful
Deploy GSM / deploy (push) Successful in 26s

- Join: [World|*] Player 'Name' joined world ... (UUID)
- Leave: [PlayerSystems] Removing player 'Name (Name)' from world ... (UUID)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-15 14:19:04 +01:00
parent 9a732c819c
commit 30a7f3edf0

View File

@@ -660,16 +660,16 @@ export async function getHytalePlayers(server) {
const logFile = logFileResult.stdout.trim();
// Parse log for player joins and disconnects
// Join pattern: [Universe|P] Adding player 'PlayerName (UUID)
// Disconnect pattern: Search for connection closed or player removed
const result = await ssh.execCommand(`grep -E "\\[Universe\\|P\\] Adding player|Removing player|Connection.*closed|disconnect" ${logFile} 2>/dev/null | tail -200`);
// Join: [World|default] Player 'Alex47' joined world 'default' at location ... (UUID)
// Leave: [PlayerSystems] Removing player 'Alex47 (Alex47)' from world 'default' (UUID)
const result = await ssh.execCommand(`grep -E "\\[World\\|.*\\] Player .* joined world|\\[PlayerSystems\\] Removing player" ${logFile} 2>/dev/null | tail -200`);
const players = new Map(); // UUID -> PlayerName
const lines = result.stdout.split('\n');
for (const line of lines) {
// Check for player join
const joinMatch = line.match(/\[Universe\|P\] Adding player '([^']+) \(([a-f0-9-]+)\)/i);
// Check for player join: [World|default] Player 'Name' joined world ... (uuid)
const joinMatch = line.match(/\[World\|[^\]]+\] Player '([^']+)' joined world .* \(([a-f0-9-]+)\)/i);
if (joinMatch) {
const playerName = joinMatch[1];
const uuid = joinMatch[2];
@@ -677,10 +677,11 @@ export async function getHytalePlayers(server) {
continue;
}
// Check for player disconnect (various patterns)
const disconnectMatch = line.match(/Removing player.*\(([a-f0-9-]+)\)/i);
if (disconnectMatch) {
players.delete(disconnectMatch[1]);
// Check for player leave: [PlayerSystems] Removing player 'Name (Name)' from world ... (uuid)
const leaveMatch = line.match(/\[PlayerSystems\] Removing player '([^']+) \([^)]+\)' from world .* \(([a-f0-9-]+)\)/i);
if (leaveMatch) {
const uuid = leaveMatch[2];
players.delete(uuid);
}
}