Use an enum for server platforms
This commit is contained in:
parent
baac1391ee
commit
d834badb78
@ -25,7 +25,7 @@ export const getMinecraftServer = (
|
|||||||
platform: Platform,
|
platform: Platform,
|
||||||
hostname: string
|
hostname: string
|
||||||
): Promise<CachedJavaMinecraftServer | CachedBedrockMinecraftServer> =>
|
): Promise<CachedJavaMinecraftServer | CachedBedrockMinecraftServer> =>
|
||||||
platform === "java"
|
platform === Platform.Java
|
||||||
? new WebRequest(
|
? new WebRequest(
|
||||||
`/server/${platform}/${hostname}`
|
`/server/${platform}/${hostname}`
|
||||||
).execute<CachedJavaMinecraftServer>()
|
).execute<CachedJavaMinecraftServer>()
|
||||||
|
12
JS-SDK/src/types/server.d.ts
vendored
12
JS-SDK/src/types/server.d.ts
vendored
@ -112,7 +112,17 @@ export type MOTD = {
|
|||||||
* A platform a Minecraft
|
* A platform a Minecraft
|
||||||
* server can operate on.
|
* 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.
|
* Types of a DNS record.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user