コード例 #1
0
ファイル: update.php プロジェクト: zmdoyouknow/MinecraftStats
                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);
}
コード例 #2
0
ファイル: util.php プロジェクト: zmdoyouknow/MinecraftStats
function isPlayerInactive($uuid)
{
    return isInactive(getPlayerLastOnline($uuid));
}