From d834badb7886281cdc7761c90ddf64100c148e6b Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Mon, 15 Apr 2024 07:56:05 -0400 Subject: [PATCH] Use an enum for server platforms --- JS-SDK/src/lib/restfulmc.ts | 2 +- JS-SDK/src/types/server.d.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/JS-SDK/src/lib/restfulmc.ts b/JS-SDK/src/lib/restfulmc.ts index d1e1913..a638e9d 100644 --- a/JS-SDK/src/lib/restfulmc.ts +++ b/JS-SDK/src/lib/restfulmc.ts @@ -25,7 +25,7 @@ export const getMinecraftServer = ( platform: Platform, hostname: string ): Promise => - platform === "java" + platform === Platform.Java ? new WebRequest( `/server/${platform}/${hostname}` ).execute() diff --git a/JS-SDK/src/types/server.d.ts b/JS-SDK/src/types/server.d.ts index 6034030..35da630 100644 --- a/JS-SDK/src/types/server.d.ts +++ b/JS-SDK/src/types/server.d.ts @@ -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.