2024-01-01 17:04:19 +00:00
|
|
|
import Database from "./database/database";
|
2024-01-01 03:45:00 +00:00
|
|
|
import Scanner from "./scanner/scanner";
|
|
|
|
import ServerManager from "./server/serverManager";
|
2024-01-01 17:19:11 +00:00
|
|
|
import WebsocketServer from "./websocket/websocket";
|
|
|
|
|
|
|
|
import Config from "../data/config.json";
|
2024-01-01 03:45:00 +00:00
|
|
|
|
2024-01-01 17:04:19 +00:00
|
|
|
/**
|
|
|
|
* The database instance.
|
|
|
|
*/
|
|
|
|
export const database = new Database();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The server manager instance.
|
|
|
|
*/
|
2024-01-01 03:45:00 +00:00
|
|
|
export const serverManager = new ServerManager();
|
2024-01-01 17:04:19 +00:00
|
|
|
|
2024-01-01 19:43:19 +00:00
|
|
|
/**
|
|
|
|
* The websocket server instance.
|
|
|
|
*/
|
|
|
|
export const websocketServer = new WebsocketServer(Config.websocket.port);
|
|
|
|
|
2024-01-01 17:04:19 +00:00
|
|
|
// The scanner is responsible for scanning all servers
|
2024-01-01 03:45:00 +00:00
|
|
|
new Scanner();
|
2024-01-01 17:04:19 +00:00
|
|
|
|
2024-01-01 17:19:11 +00:00
|
|
|
// The websocket server is responsible for
|
|
|
|
// sending data to the client in real time
|
|
|
|
|
|
|
|
// serverManager.getServers().forEach((server) => {
|
|
|
|
// const record = database.getRecord(server.getID());
|
|
|
|
// if (!record) {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// console.log(
|
|
|
|
// `Record for "${server.getName()}": ${record.playerCount} (${formatTimestamp(
|
|
|
|
// record.timestamp
|
|
|
|
// )})`
|
|
|
|
// );
|
|
|
|
// });
|