diff --git a/Lib/bun.lockb b/Lib/bun.lockb index a235c21..5a75fff 100644 Binary files a/Lib/bun.lockb and b/Lib/bun.lockb differ diff --git a/Lib/package.json b/Lib/package.json index 958252f..9f46576 100644 --- a/Lib/package.json +++ b/Lib/package.json @@ -1,40 +1,37 @@ { - "name": "restfulmc", - "version": "1.0.0", - "author": "Braydon (Rainnny) ", - "description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.", - "keywords": [ - "java", - "minecraft", - "json", - "rest-api", - "restful", - "bedrock", - "springboot" - ], - "homepage": "https://github.com/Rainnny7/RESTfulMC", - "repository": { - "type": "git", - "url": "git+https://github.com/Rainnny7/RESTfulMC.git" - }, - "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "bun run build.mjs", - "prepublishOnly": "bun run build" - }, - "files": [ - "dist" - ], - "devDependencies": { - "@types/bun": "latest", - "bun-plugin-dts": "^0.2.2" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "dependencies": { - "axios": "^1.6.8" - } + "name": "restfulmc", + "version": "1.0.4", + "author": "Braydon (Rainnny) ", + "description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.", + "keywords": [ + "java", + "minecraft", + "json", + "rest-api", + "restful", + "bedrock", + "springboot" + ], + "homepage": "https://github.com/Rainnny7/RESTfulMC", + "repository": { + "type": "git", + "url": "git+https://github.com/Rainnny7/RESTfulMC.git" + }, + "license": "MIT", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "bun run build.mjs", + "prepublishOnly": "bun run build" + }, + "files": [ + "dist" + ], + "devDependencies": { + "@types/bun": "latest", + "bun-plugin-dts": "^0.2.2" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } } diff --git a/Lib/src/lib/restfulmc.ts b/Lib/src/lib/restfulmc.ts index 0527ba6..0dac0bc 100644 --- a/Lib/src/lib/restfulmc.ts +++ b/Lib/src/lib/restfulmc.ts @@ -1,5 +1,7 @@ import type { Player } from "../types/player"; +const ENDPOINT = "https://mc.rainnny.club"; // The API endpoint to use + /** * Get a player by their username or UUID. * @@ -7,15 +9,8 @@ import type { Player } from "../types/player"; * @returns the promised player */ export const getPlayer = (query: string): Promise => { - return new Promise((resolve, reject) => { - resolve({ - uniqueId: "fc1d5fe7-f29b-430d-80bb-3b093a638b0f", - username: "Rainnny", - skin: { - url: "", - model: "default", - legacy: false, - }, - }); + return new Promise(async (resolve, reject) => { + const response: Response = await fetch(`${ENDPOINT}/player/${query}`); // Request the player + resolve((await response.json()) as Player); // Resolve the player }); };