echo $players[$uuid]['name'] . "\n"; } else { //if yes, update the name from the user cache - it may have changed if (isset($userCache[$uuid])) { $players[$uuid]['name'] = $userCache[$uuid]; } } $lastOnline = filemtime($jsonFile); $players[$uuid]['date'] = $lastOnline; //Parse JSON $json = json_decode(file_get_contents($jsonFile), true); //Count stats foreach ($stats as $id => $stat) { $value = getStatProgressForPlayer($id, $json); if ($value !== FALSE) { if (!isInactive($lastOnline) || isPlayerListStat($id)) { //Insert into ranking $stats[$id]['ranking'][] = ['id' => $uuid, 'score' => $value]; } //Set player stat $playerStats[$uuid][$id] = ['score' => $value]; } } } } closedir($dir); } //Create data directories if necessary if (!is_dir($dataDir)) { mkdir($dataDir, 0755); }
function isPlayerInactive($uuid) { return isInactive(getPlayerLastOnline($uuid)); }