Add debug logging to Hytale player detection
All checks were successful
Deploy GSM / deploy (push) Successful in 30s
All checks were successful
Deploy GSM / deploy (push) Successful in 30s
This commit is contained in:
@@ -649,11 +649,13 @@ const HYTALE_LOGS_PATH = "/opt/hytale/Server/logs";
|
||||
|
||||
// Get Hytale players by parsing server logs
|
||||
export async function getHytalePlayers(server) {
|
||||
try {
|
||||
const ssh = await getConnection(server.host, server.sshUser);
|
||||
|
||||
// Find the most recent log file
|
||||
const logFileResult = await ssh.execCommand(`ls -t ${HYTALE_LOGS_PATH}/*.log 2>/dev/null | head -1`);
|
||||
if (!logFileResult.stdout.trim()) {
|
||||
console.log('[Hytale] No log file found');
|
||||
return { online: 0, players: [] };
|
||||
}
|
||||
|
||||
@@ -666,7 +668,7 @@ export async function getHytalePlayers(server) {
|
||||
|
||||
const players = new Map(); // UUID -> PlayerName
|
||||
|
||||
const lines = result.stdout.split('\n');
|
||||
const lines = result.stdout.split('\n').filter(l => l.trim());
|
||||
for (const line of lines) {
|
||||
// Check for player join: [World|default] Player 'Name' joined world ... (uuid)
|
||||
const joinMatch = line.match(/\[World\|[^\]]+\] Player '([^']+)' joined world .* \(([a-f0-9-]+)\)/i);
|
||||
@@ -686,7 +688,12 @@ export async function getHytalePlayers(server) {
|
||||
}
|
||||
|
||||
const playerList = Array.from(players.values());
|
||||
console.log(`[Hytale] Found ${playerList.length} players: ${playerList.join(', ') || 'none'}`);
|
||||
return { online: playerList.length, players: playerList };
|
||||
} catch (err) {
|
||||
console.error(`[Hytale] Error getting players:`, err.message);
|
||||
return { online: 0, players: [] };
|
||||
}
|
||||
}
|
||||
|
||||
export async function readHytaleConfig(server) {
|
||||
|
||||
Reference in New Issue
Block a user