From d1365ae261adcf4177d8c497ae410b37e5fa4097 Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Mon, 15 Apr 2024 08:49:09 -0400 Subject: [PATCH] Cleanup --- JS-SDK/bun.lockb | Bin 10553 -> 10557 bytes JS-SDK/src/index.d.ts | 3 +- JS-SDK/src/index.ts | 2 +- JS-SDK/src/lib/webRequest.ts | 2 +- JS-SDK/src/types/dns.d.ts | 14 ++++-- JS-SDK/src/types/mojang.d.ts | 11 ++++- JS-SDK/src/types/{player.d.ts => player.ts} | 44 ++++++++++++++---- JS-SDK/src/types/server/bedrock-server.d.ts | 11 +++-- JS-SDK/src/types/server/java-server.d.ts | 16 +++---- .../types/{server.d.ts => server/server.ts} | 17 +++---- JS-SDK/tsconfig.json | 7 +-- 11 files changed, 82 insertions(+), 45 deletions(-) rename JS-SDK/src/types/{player.d.ts => player.ts} (75%) rename JS-SDK/src/types/{server.d.ts => server/server.ts} (88%) diff --git a/JS-SDK/bun.lockb b/JS-SDK/bun.lockb index 6ab7344095160e0348d6dbe0c32464cf707799ac..def316298a6895c237086e9349f8f7f3d30bf814 100644 GIT binary patch delta 876 zcmYjPT}TvR6#ef0xVxEVrMnHw{wPsIHSVsiyDQpch+##7U~EfBmSKjLW)NeLMGp}f zv|a+kLPB~eLScy*q91)Nq>?NPA0mPXQKCRr3OcjnKri>q;hgV$_nUjQ=4Z_}57MJ_ zQ?$E4h)bnHh(h31;9B4eun5=(EC#A=XFK%o6*6=+96t>z7FYS4MTj-<1*`^6fqTH8 z0P}(K@T~_roK=fL%o^%f&Z6$;gjJytR#EdJLsh74ox++MdyzSMrO@DQw4I3?d*?=iW`3!IEL(NrHd`J|{h+>*k^)bW!asx8!7DaYgr zA!cw=AGg1vq3wJBtuiQKIV6WL7ryK3@J{36b(4K0UuX$Myf85BM;(PGVac{uw4+~-LON#D%Zde}efiVgr6g~1k zqq#FJGYgyh&lDYoF=ixIacw~Inv3|iiza%?>OVoRl<@{3^t&V);OlUi8}>H&;7#N2 z(Qg*I7>27-h#`IvkfP>hrOQ({wmhy)K#!oCuv}s8-q@>Qb@bG`PAG9XDu+X2mJ5Os dC3$P`HWl+^&_nlmE*P@y?CLz0ag~Og{{XS*)L;Mr delta 879 zcmYjPT}TvR6#ef0xI3A)X}dOU`=eAo1k>*7w!5ZHh8RX9h=%P$CvL?S`- zV=b4^pb+V)dPrCz_Cd>63o2_13yB_z5J7^{_95uZjswlZJ#*%qd%ye5z0+;kw%bSP zVY)TiCkb)cCxj>kjsQ0TUjtph6mSbr>%P!4fcI50bS)e|2P&4s!A3#)QDU+58LCM$M*qF*mS36Q>C3~ zzaFZchix&b8|)aEmB|{Do`LNLa~9Zdu)|;$p0&nE<*Z$$E1b8h(ll-tDfsjnf57U% z9C{WtaJER5uHv2t3%PL6drml1+RhqcCub4IIFI<96Hb-3v4+@{$vQ`hUFI~Z@i&7g zkZJTBpv(>TMF&YtKAFnd>yy3aFw-BV##hSLhMc&w@uaxbCr3v>^dY-TTaqVFf2_06 ziCQJ5)CggY-Cxt({bTS>6_l_NQbPFueBamOox{PKkolzdaqd<5j0buIdQ^x74)|qS z;uXJ#Tm3#-k!DLqPVL3;FjfP4!nbeS%)A;0{9QXUR0g*WofZ?QQ3y zH!Z&=zFFu}7_M3&M)`R_j+z^m-jlq!>uEy*dIa5sl^SygAG{pbCeF - * 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 } }