diff --git a/JS-SDK/bun.lockb b/JS-SDK/bun.lockb index 6ab7344..def3162 100644 Binary files a/JS-SDK/bun.lockb and b/JS-SDK/bun.lockb differ diff --git a/JS-SDK/src/index.d.ts b/JS-SDK/src/index.d.ts index 560bc7d..6be1fae 100644 --- a/JS-SDK/src/index.d.ts +++ b/JS-SDK/src/index.d.ts @@ -1,7 +1,6 @@ -export * from "./types/dns"; export * from "./types/generic"; export * from "./types/mojang"; export * from "./types/player"; -export * from "./types/server"; export * from "./types/server/bedrock-server"; export * from "./types/server/java-server"; +export * from "./types/server/server"; diff --git a/JS-SDK/src/index.ts b/JS-SDK/src/index.ts index cd141a2..d0ed23a 100644 --- a/JS-SDK/src/index.ts +++ b/JS-SDK/src/index.ts @@ -1 +1 @@ -export * from "@/lib/restfulmc"; +export * from "./lib/restfulmc"; diff --git a/JS-SDK/src/lib/webRequest.ts b/JS-SDK/src/lib/webRequest.ts index ab13ae6..26f114c 100644 --- a/JS-SDK/src/lib/webRequest.ts +++ b/JS-SDK/src/lib/webRequest.ts @@ -1,4 +1,4 @@ -import { ErrorResponse } from "@/types/generic"; +import { ErrorResponse } from "../types/generic"; const ENDPOINT = "https://mc.rainnny.club"; // The API endpoint to use diff --git a/JS-SDK/src/types/dns.d.ts b/JS-SDK/src/types/dns.d.ts index d08e28a..0bf6e5e 100644 --- a/JS-SDK/src/types/dns.d.ts +++ b/JS-SDK/src/types/dns.d.ts @@ -1,7 +1,7 @@ /** * An A record. */ -export interface ARecord extends DNSRecord { +interface ARecord extends DNSRecord { /** * The address of this record, undefined if unresolved. */ @@ -11,7 +11,7 @@ export interface ARecord extends DNSRecord { /** * An SRV record. */ -export interface SRVRecord extends DNSRecord { +interface SRVRecord extends DNSRecord { /** * The priority of this record. */ @@ -36,7 +36,7 @@ export interface SRVRecord extends DNSRecord { /** * A representation of a DNS record. */ -export type DNSRecord = { +type DNSRecord = { /** * The type of this record. */ @@ -47,3 +47,11 @@ export type DNSRecord = { */ ttl: number; }; + +/** + * Types of a DNS record. + */ +enum RecordType { + A, + SRV, +} diff --git a/JS-SDK/src/types/mojang.d.ts b/JS-SDK/src/types/mojang.d.ts index fcf42cb..bf518e1 100644 --- a/JS-SDK/src/types/mojang.d.ts +++ b/JS-SDK/src/types/mojang.d.ts @@ -3,5 +3,14 @@ * a service provided by Mojang. */ export type MojangServerStatus = { - [key: string]: string; + [endpoint: string]: Status; }; + +/** + * The status of a service. + */ +enum Status { + ONLINE, + DEGRADED, + OFFLINE, +} diff --git a/JS-SDK/src/types/player.d.ts b/JS-SDK/src/types/player.ts similarity index 75% rename from JS-SDK/src/types/player.d.ts rename to JS-SDK/src/types/player.ts index 95e84a5..6423ffa 100644 --- a/JS-SDK/src/types/player.d.ts +++ b/JS-SDK/src/types/player.ts @@ -57,7 +57,7 @@ export type Player = { /** * A skin for a {@link Player}. */ -export type Skin = { +type Skin = { /** * The texture URL of this skin. */ @@ -76,24 +76,49 @@ export type Skin = { /** * URLs to the parts of this skin. *

- * The key is the part name, and - * the value is the URL. + * The key is the part, and the + * value is the URL to the part. *

*/ parts: { - [key: string]: string; + [part in SkinPart]: string; }; }; /** * Possible models for a skin. */ -export type SkinModel = "default" | "slim"; +enum SkinModel { + DEFAULT, + SLIM, +} + +/** + * A part of a skin texture. + */ +export enum SkinPart { + HEAD_OVERLAY_FACE, + HEAD_TOP, + HEAD, + FACE, + HEAD_LEFT, + HEAD_RIGHT, + HEAD_BOTTOM, + HEAD_BACK, + BODY_FRONT, + BODY, + LEFT_ARM_TOP, + RIGHT_ARM_TOP, + LEFT_ARM_FRONT, + RIGHT_ARM_FRONT, + LEFT_LEG_FRONT, + RIGHT_LEG_FRONT, +} /** * A cape for a {@link Player}. */ -export type Cape = { +type Cape = { /** * The texture URL of this cape. */ @@ -103,7 +128,7 @@ export type Cape = { /** * A property of a Mojang profile. */ -export type ProfileProperty = { +type ProfileProperty = { /** * The name of this property. */ @@ -124,4 +149,7 @@ export type ProfileProperty = { /** * Profile actions that can */ -export type ProfileAction = "FORCED_NAME_CHANGE" | "USING_BANNED_SKIN"; +enum ProfileAction { + FORCED_NAME_CHANGE, + USING_BANNED_SKIN, +} diff --git a/JS-SDK/src/types/server/bedrock-server.d.ts b/JS-SDK/src/types/server/bedrock-server.d.ts index 79cf629..a8071a1 100644 --- a/JS-SDK/src/types/server/bedrock-server.d.ts +++ b/JS-SDK/src/types/server/bedrock-server.d.ts @@ -1,4 +1,4 @@ -import { MinecraftServer } from "@/types/server"; +import { MinecraftServer } from "./server"; /** * A cacheable {@link BedrockMinecraftServer}. @@ -39,12 +39,15 @@ export interface BedrockMinecraftServer extends MinecraftServer { /** * The edition of a Bedrock server. */ -export type Edition = "MCPE" | "MCEE"; +enum Edition { + MCPE, + MCEE, +} /** * Version information for a server. */ -export type BedrockVersion = { +type BedrockVersion = { /** * The protocol version of the server. */ @@ -59,7 +62,7 @@ export type BedrockVersion = { /** * The gamemode of a server. */ -export type GameMode = { +type GameMode = { /** * The name of this gamemode. */ diff --git a/JS-SDK/src/types/server/java-server.d.ts b/JS-SDK/src/types/server/java-server.d.ts index cafd495..d5e7291 100644 --- a/JS-SDK/src/types/server/java-server.d.ts +++ b/JS-SDK/src/types/server/java-server.d.ts @@ -1,4 +1,4 @@ -import { MinecraftServer } from "@/types/server"; +import { MinecraftServer } from "./server"; /** * A cacheable {@link JavaMinecraftServer}. @@ -70,7 +70,7 @@ export interface JavaMinecraftServer extends MinecraftServer { /** * Version information for a server. */ -export type JavaVersion = { +type JavaVersion = { /** * The version name of the server. */ @@ -100,7 +100,7 @@ export type JavaVersion = { /** * The favicon for a server. */ -export type Favicon = { +type Favicon = { /** * The raw Base64 encoded favicon. */ @@ -118,7 +118,7 @@ export type Favicon = { * This is for servers on 1.12 or below. *

*/ -export type ModInfo = { +type ModInfo = { /** * The type of modded server this is. */ @@ -133,7 +133,7 @@ export type ModInfo = { /** * A legacy Forge mod for a server. */ -export type LegacyForgeMod = { +type LegacyForgeMod = { /** * The name of this mod. */ @@ -151,7 +151,7 @@ export type LegacyForgeMod = { * This is for servers on 1.13 and above. *

*/ -export type ForgeData = { +type ForgeData = { /** * The list of channels on this server, empty if none. */ @@ -180,7 +180,7 @@ export type ForgeData = { /** * A Forge channel for a server. */ -export type ForgeChannel = { +type ForgeChannel = { /** * The name of this channel. */ @@ -200,7 +200,7 @@ export type ForgeChannel = { /** * A modern Forge mod for a server. */ -export type ModernForgeMod = { +type ModernForgeMod = { /** * The name of this mod. */ diff --git a/JS-SDK/src/types/server.d.ts b/JS-SDK/src/types/server/server.ts similarity index 88% rename from JS-SDK/src/types/server.d.ts rename to JS-SDK/src/types/server/server.ts index 35da630..c7d0708 100644 --- a/JS-SDK/src/types/server.d.ts +++ b/JS-SDK/src/types/server/server.ts @@ -36,7 +36,7 @@ export type MinecraftServer = { /** * Player count data for a server. */ -export type Players = { +type Players = { /** * The online players on this server. */ @@ -56,7 +56,7 @@ export type Players = { /** * A sample player. */ -export type PlayerSample = { +type PlayerSample = { /** * The ID of this player. */ @@ -71,7 +71,7 @@ export type PlayerSample = { /** * The name of a sample player. */ -export type PlayerSampleName = { +type PlayerSampleName = { /** * The raw name. */ @@ -91,7 +91,7 @@ export type PlayerSampleName = { /** * The MOTD for a server. */ -export type MOTD = { +type MOTD = { /** * The raw MOTD lines. */ @@ -116,15 +116,10 @@ export enum Platform { /** * The Java edition of Minecraft. */ - Java, + JAVA = "java", /** * The Bedrock edition of Minecraft. */ - Bedrock, + BEDROCK = "bedrock", } - -/** - * Types of a DNS record. - */ -export type RecordType = "A" | "SRV"; diff --git a/JS-SDK/tsconfig.json b/JS-SDK/tsconfig.json index a9beb5d..90f2f8f 100644 --- a/JS-SDK/tsconfig.json +++ b/JS-SDK/tsconfig.json @@ -11,11 +11,6 @@ "allowJs": true, "noEmit": true, "outDir": "dist", - "resolveJsonModule": true, - "paths": { - "@/*": ["./*"], - "@/lib/*": ["./src/lib/*"], - "@/types/*": ["./src/types/*"] - } + "resolveJsonModule": true } }