mc-tracker/src/index.ts
2024-01-01 17:08:36 +00:00

30 lines
700 B
TypeScript

import Database from "./database/database";
import Scanner from "./scanner/scanner";
import ServerManager from "./server/serverManager";
import { formatTimestamp } from "./utils/timeUtils";
/**
* The database instance.
*/
export const database = new Database();
/**
* The server manager instance.
*/
export const serverManager = new ServerManager();
// The scanner is responsible for scanning all servers
new Scanner();
serverManager.getServers().forEach((server) => {
const record = database.getRecord(server.getID());
if (!record) {
return;
}
console.log(
`Record for "${server.getName()}": ${record.playerCount} (${formatTimestamp(
record.timestamp
)})`
);
});