JS SDK: Add Geo and query data to servers
Some checks failed
Publish JS SDK / docker (push) Failing after 18s

This commit is contained in:
Braydon 2024-04-26 17:00:40 -04:00
parent 856e445182
commit 9d594a8c37
11 changed files with 118 additions and 37 deletions

@ -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.
* <p>
@ -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.
* <p>

@ -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.
*/

@ -1,9 +1,4 @@
import {
ServerPlatform,
getJavaServerFavicon,
getMinecraftServer,
isMojangBlocked,
} from "@/index";
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";