initital commit

This commit is contained in:
Lee
2024-04-14 21:11:46 +01:00
parent 5876f13f70
commit eb0facd38e
25 changed files with 3120 additions and 0 deletions

25
src/server/mojang.ts Normal file
View File

@ -0,0 +1,25 @@
import { MinecraftUtils } from "..";
import WebRequest from "../common/WebRequest";
import { CachedEndpointStatus } from "../types/cache/cachedEndpointStatus";
export default class MojangTools {
public endpointStatusEndpoint = MinecraftUtils.API_ENDPOINT + "/mojang/status";
/**
* Gets the Mojang API status.
*
* @returns the Mojang API status
*/
public getMojangEndpointStatus(): Promise<CachedEndpointStatus> {
return new Promise(async (resolve, reject) => {
const response = await WebRequest.get(this.endpointStatusEndpoint);
const data = response.data;
if (response.status !== 200) {
reject(null);
return;
}
resolve(data);
});
}
}