use name to identify servers not ip
All checks were successful
Publish Docker Image / docker (push) Successful in 43s
All checks were successful
Publish Docker Image / docker (push) Successful in 43s
This commit is contained in:
parent
56a75560e8
commit
8826a2530a
1
.gitignore
vendored
1
.gitignore
vendored
@ -230,4 +230,3 @@ data/db.sqlite-wal
|
||||
data/database-backups
|
||||
|
||||
data/config.json
|
||||
data/servers.json
|
@ -2,73 +2,61 @@
|
||||
{
|
||||
"name": "WildPrison",
|
||||
"ip": "wildprison.net",
|
||||
"type": "PC",
|
||||
"id": 0
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "Hypixel",
|
||||
"ip": "mc.hypixel.net",
|
||||
"type": "PC",
|
||||
"id": 1
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "CubeCraft",
|
||||
"name": "Cubecraft",
|
||||
"ip": "play.cubecraft.net",
|
||||
"type": "PC",
|
||||
"id": 2
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "Mineplex",
|
||||
"ip": "mineplex.com",
|
||||
"type": "PC",
|
||||
"id": 3
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "2b2t",
|
||||
"ip": "2b2t.org",
|
||||
"type": "PC",
|
||||
"id": 4
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "AkumaMC",
|
||||
"ip": "akumamc.net",
|
||||
"type": "PC",
|
||||
"id": 5
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "Wynncraft",
|
||||
"ip": "play.wynncraft.com",
|
||||
"type": "PC",
|
||||
"id": 6
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "Minehut",
|
||||
"ip": "minehut.com",
|
||||
"type": "PC",
|
||||
"id": 7
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "Grand Theft Minecraft",
|
||||
"ip": "gtm.network",
|
||||
"type": "PC",
|
||||
"id": 8
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "HiveMC",
|
||||
"ip": "geo.hivebedrock.network",
|
||||
"type": "PE",
|
||||
"id": 9
|
||||
"type": "PE"
|
||||
},
|
||||
{
|
||||
"name": "Purple Prison",
|
||||
"ip": "MCSL.PURPLE.WTF",
|
||||
"type": "PC",
|
||||
"id": 10
|
||||
"type": "PC"
|
||||
},
|
||||
{
|
||||
"name": "MinecraftOnline",
|
||||
"ip": "minecraftonline.com",
|
||||
"type": "PC",
|
||||
"id": 11
|
||||
"type": "PC"
|
||||
}
|
||||
]
|
@ -20,7 +20,6 @@ export enum ServerStatus {
|
||||
}
|
||||
|
||||
type ServerOptions = {
|
||||
id: number;
|
||||
name: string;
|
||||
ip: string;
|
||||
port?: number;
|
||||
@ -33,11 +32,6 @@ type DnsInfo = {
|
||||
};
|
||||
|
||||
export default class Server {
|
||||
/**
|
||||
* The ID of the server.
|
||||
*/
|
||||
private id: number;
|
||||
|
||||
/**
|
||||
* The name of the server.
|
||||
*/
|
||||
@ -71,8 +65,7 @@ export default class Server {
|
||||
hasResolved: false,
|
||||
};
|
||||
|
||||
constructor({ id, name, ip, port, type }: ServerOptions) {
|
||||
this.id = id;
|
||||
constructor({ name, ip, port, type }: ServerOptions) {
|
||||
this.name = name;
|
||||
this.ip = ip;
|
||||
this.port = port;
|
||||
@ -106,7 +99,7 @@ export default class Server {
|
||||
try {
|
||||
influx.writePoint(
|
||||
new Point("playerCount")
|
||||
.tag("id", this.getID().toString())
|
||||
.tag("name", this.getName())
|
||||
.tag("ip", this.getIP().toLowerCase())
|
||||
.intField("playerCount", response.playerCount)
|
||||
.timestamp(response.timestamp)
|
||||
@ -163,7 +156,6 @@ export default class Server {
|
||||
|
||||
this.favicon = res.favicon; // Set the favicon
|
||||
resolve({
|
||||
id: this.getID(),
|
||||
timestamp: Date.now(),
|
||||
ip: ip,
|
||||
playerCount: res.players.online,
|
||||
@ -189,7 +181,6 @@ export default class Server {
|
||||
}
|
||||
|
||||
resolve({
|
||||
id: this.getID(),
|
||||
timestamp: Date.now(),
|
||||
ip: this.getIP(),
|
||||
playerCount: res.currentPlayers,
|
||||
@ -199,15 +190,6 @@ export default class Server {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the server.
|
||||
*
|
||||
* @returns the ID
|
||||
*/
|
||||
public getID(): number {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the server.
|
||||
*
|
||||
|
@ -15,7 +15,6 @@ export default class ServerManager {
|
||||
logger.info("Loading servers");
|
||||
for (const configServer of Servers) {
|
||||
const server = new Server({
|
||||
id: configServer.id,
|
||||
ip: configServer.ip,
|
||||
name: configServer.name,
|
||||
type: configServer.type as ServerType,
|
||||
|
@ -1,5 +1,4 @@
|
||||
export type Ping = {
|
||||
id: number;
|
||||
timestamp: number;
|
||||
ip: string;
|
||||
playerCount: number;
|
||||
|
Loading…
Reference in New Issue
Block a user