Use an enum for server platforms

This commit is contained in:
Braydon 2024-04-15 07:56:05 -04:00
parent baac1391ee
commit d834badb78
2 changed files with 12 additions and 2 deletions

@ -25,7 +25,7 @@ export const getMinecraftServer = (
platform: Platform,
hostname: string
): Promise<CachedJavaMinecraftServer | CachedBedrockMinecraftServer> =>
platform === "java"
platform === Platform.Java
? new WebRequest(
`/server/${platform}/${hostname}`
).execute<CachedJavaMinecraftServer>()

@ -112,7 +112,17 @@ export type MOTD = {
* A platform a Minecraft
* server can operate on.
*/
export type Platform = "java" | "bedrock";
export enum Platform {
/**
* The Java edition of Minecraft.
*/
Java,
/**
* The Bedrock edition of Minecraft.
*/
Bedrock,
}
/**
* Types of a DNS record.