diff --git a/JS-SDK/src/lib/restfulmc.ts b/JS-SDK/src/lib/restfulmc.ts index 37adcac..141c89a 100644 --- a/JS-SDK/src/lib/restfulmc.ts +++ b/JS-SDK/src/lib/restfulmc.ts @@ -1,11 +1,11 @@ -import { WebRequest } from "@/lib/web-request"; -import { HttpMethod } from "@/types/http-method"; -import { MojangServerStatusResponse } from "@/types/mojang/server-status-response"; -import { CachedPlayer } from "@/types/player/player"; -import { SkinPart } from "@/types/player/skin-part"; -import { CachedBedrockMinecraftServer } from "@/types/server/bedrock/server"; -import { CachedJavaMinecraftServer } from "@/types/server/java-server"; -import { ServerPlatform } from "@/types/server/platform"; +import {WebRequest} from "@/lib/web-request"; +import {HttpMethod} from "@/types/http-method"; +import {MojangServerStatusResponse} from "@/types/mojang/server-status-response"; +import {CachedPlayer} from "@/types/player/player"; +import {SkinPart} from "@/types/player/skin-part"; +import {CachedBedrockMinecraftServer} from "@/types/server/bedrock/server"; +import {CachedJavaMinecraftServer} from "@/types/server/java-server"; +import {ServerPlatform} from "@/types/server/platform"; /** * Get a player by their username or UUID. diff --git a/JS-SDK/src/lib/web-request.ts b/JS-SDK/src/lib/web-request.ts index 9ce341b..112b290 100644 --- a/JS-SDK/src/lib/web-request.ts +++ b/JS-SDK/src/lib/web-request.ts @@ -1,5 +1,5 @@ -import { RestfulMCAPIError } from "@/types/error"; -import { HttpMethod } from "@/types/http-method"; +import {RestfulMCAPIError} from "@/types/error"; +import {HttpMethod} from "@/types/http-method"; const API_ENDPOINT = "https://api.restfulmc.cc"; // The API endpoint to use diff --git a/JS-SDK/src/types/dns/dns-record.d.ts b/JS-SDK/src/types/dns/dns-record.d.ts index 9239cd1..d4f0bc3 100644 --- a/JS-SDK/src/types/dns/dns-record.d.ts +++ b/JS-SDK/src/types/dns/dns-record.d.ts @@ -1,4 +1,4 @@ -import { RecordType } from "@/type/dns/record-type"; +import {RecordType} from "@/type/dns/record-type"; /** * An A record. diff --git a/JS-SDK/src/types/mojang/server-status-response.d.ts b/JS-SDK/src/types/mojang/server-status-response.d.ts index 08822af..013390b 100644 --- a/JS-SDK/src/types/mojang/server-status-response.d.ts +++ b/JS-SDK/src/types/mojang/server-status-response.d.ts @@ -1,4 +1,4 @@ -import { MojangServerStatus } from "@/types/mojang/server-status"; +import {MojangServerStatus} from "@/types/mojang/server-status"; /** * Represents the status of diff --git a/JS-SDK/src/types/player/player.ts b/JS-SDK/src/types/player/player.ts index 60e9801..2a2555a 100644 --- a/JS-SDK/src/types/player/player.ts +++ b/JS-SDK/src/types/player/player.ts @@ -1,6 +1,6 @@ -import { ProfileAction } from "@/types/player/profile-action"; -import { SkinModel } from "@/types/player/skin-model"; -import { SkinPart } from "@/types/player/skin-part"; +import {ProfileAction} from "@/types/player/profile-action"; +import {SkinModel} from "@/types/player/skin-model"; +import {SkinPart} from "@/types/player/skin-part"; /** * A cacheable {@link Player}. diff --git a/JS-SDK/src/types/server/bedrock/server.d.ts b/JS-SDK/src/types/server/bedrock/server.d.ts index bd48a23..4e2d0e0 100644 --- a/JS-SDK/src/types/server/bedrock/server.d.ts +++ b/JS-SDK/src/types/server/bedrock/server.d.ts @@ -1,5 +1,5 @@ -import { Edition } from "@/types/server/bedrock/edition"; -import { MinecraftServer } from "@/types/server/server"; +import {Edition} from "@/types/server/bedrock/edition"; +import {MinecraftServer} from "@/types/server/server"; /** * A cacheable {@link BedrockMinecraftServer}. diff --git a/JS-SDK/src/types/server/java-server.d.ts b/JS-SDK/src/types/server/java-server.d.ts index 6118b38..66bf6f6 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/server"; +import {MinecraftServer} from "@/types/server/server"; /** * A cacheable {@link JavaMinecraftServer}. @@ -25,6 +25,17 @@ export interface JavaMinecraftServer extends MinecraftServer { */ favicon?: Favicon | undefined; + /** + * The software of this server, present if query is on. + */ + software?: string | undefined; + + /** + * The plugins on this server, present if + * query is on and plugins are present. + */ + plugins?: Plugin[] | undefined; + /** * The Forge mod information for this server, undefined if none. *
@@ -41,6 +52,16 @@ export interface JavaMinecraftServer extends MinecraftServer { */ forgeData?: ForgeData | undefined; + /** + * The main world of this server, present if query is on. + */ + world?: string | undefined; + + /** + * Does this server support querying? + */ + queryEnabled: boolean; + /** * Does this server preview chat? * @@ -112,6 +133,21 @@ type Favicon = { url: string; }; +/** + * A plugin for a server. + */ +type Plugin = { + /** + * The name of this plugin. + */ + name: string; + + /** + * The version of this plugin. + */ + version: string; +}; + /** * Forge mod information for a server. *
diff --git a/JS-SDK/src/types/server/server.ts b/JS-SDK/src/types/server/server.ts index b4bfa67..1a2272a 100644 --- a/JS-SDK/src/types/server/server.ts +++ b/JS-SDK/src/types/server/server.ts @@ -1,4 +1,4 @@ -import { ARecord, SRVRecord } from "@/types/dns/dns-record"; +import {ARecord, SRVRecord} from "@/types/dns/dns-record"; /** * A model representing a Minecraft server. @@ -24,6 +24,11 @@ export type MinecraftServer = { */ records: ARecord | SRVRecord[]; + /** + * The Geo location of this server, undefined if unknown. + */ + geo?: GeoLocation | undefined; + /** * The player counts of this server. */ @@ -35,6 +40,51 @@ export type MinecraftServer = { motd: MOTD; }; +/** + * The Geo location of a server. + */ +type GeoLocation = { + /** + * The continent of this server. + */ + continent: LocationData; + + /** + * The country of this server. + */ + country: LocationData; + + /** + * The city of this server, undefined if unknown. + */ + city?: string | undefined; + + /** + * The latitude of this server. + */ + latitude: number; + + /** + * The longitude of this server. + */ + longitude: number; +} + +/** + * Data for a location. + */ +type LocationData = { + /** + * The location code. + */ + code: string; + + /** + * The location name. + */ + name: string; +} + /** * Player count data for a server. */ diff --git a/JS-SDK/test/mojang.test.ts b/JS-SDK/test/mojang.test.ts index 9470558..49b908b 100644 --- a/JS-SDK/test/mojang.test.ts +++ b/JS-SDK/test/mojang.test.ts @@ -1,6 +1,6 @@ -import { getMojangServerStatus } from "@/index"; -import { MojangServerStatusResponse } from "@/types/mojang/server-status-response"; -import { expect, test } from "bun:test"; +import {getMojangServerStatus} from "@/index"; +import {MojangServerStatusResponse} from "@/types/mojang/server-status-response"; +import {expect, test} from "bun:test"; /** * Run a test to ensure retrieving diff --git a/JS-SDK/test/player.test.ts b/JS-SDK/test/player.test.ts index 564142e..e8859fa 100644 --- a/JS-SDK/test/player.test.ts +++ b/JS-SDK/test/player.test.ts @@ -1,8 +1,8 @@ -import { getPlayer, getSkinPart } from "@/index"; -import { RestfulMCAPIError } from "@/types/error"; -import { CachedPlayer } from "@/types/player/player"; -import { SkinPart } from "@/types/player/skin-part"; -import { expect, test } from "bun:test"; +import {getPlayer, getSkinPart} from "@/index"; +import {RestfulMCAPIError} from "@/types/error"; +import {CachedPlayer} from "@/types/player/player"; +import {SkinPart} from "@/types/player/skin-part"; +import {expect, test} from "bun:test"; /** * Run a test to ensure retrieving diff --git a/JS-SDK/test/server.test.ts b/JS-SDK/test/server.test.ts index 50c62f1..630ac6e 100644 --- a/JS-SDK/test/server.test.ts +++ b/JS-SDK/test/server.test.ts @@ -1,13 +1,8 @@ -import { - ServerPlatform, - getJavaServerFavicon, - getMinecraftServer, - isMojangBlocked, -} from "@/index"; -import { RestfulMCAPIError } from "@/types/error"; -import { CachedBedrockMinecraftServer } from "@/types/server/bedrock/server"; -import { CachedJavaMinecraftServer } from "@/types/server/java-server"; -import { expect, test } from "bun:test"; +import {getJavaServerFavicon, getMinecraftServer, isMojangBlocked, ServerPlatform,} from "@/index"; +import {RestfulMCAPIError} from "@/types/error"; +import {CachedBedrockMinecraftServer} from "@/types/server/bedrock/server"; +import {CachedJavaMinecraftServer} from "@/types/server/java-server"; +import {expect, test} from "bun:test"; /** * Run a test to ensure retrieving a