functional lib
This commit is contained in:
BIN
Lib/bun.lockb
BIN
Lib/bun.lockb
Binary file not shown.
@ -1,40 +1,37 @@
|
|||||||
{
|
{
|
||||||
"name": "restfulmc",
|
"name": "restfulmc",
|
||||||
"version": "1.0.0",
|
"version": "1.0.4",
|
||||||
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
||||||
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
|
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"java",
|
"java",
|
||||||
"minecraft",
|
"minecraft",
|
||||||
"json",
|
"json",
|
||||||
"rest-api",
|
"rest-api",
|
||||||
"restful",
|
"restful",
|
||||||
"bedrock",
|
"bedrock",
|
||||||
"springboot"
|
"springboot"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/Rainnny7/RESTfulMC",
|
"homepage": "https://github.com/Rainnny7/RESTfulMC",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/Rainnny7/RESTfulMC.git"
|
"url": "git+https://github.com/Rainnny7/RESTfulMC.git"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "bun run build.mjs",
|
"build": "bun run build.mjs",
|
||||||
"prepublishOnly": "bun run build"
|
"prepublishOnly": "bun run build"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bun": "latest",
|
"@types/bun": "latest",
|
||||||
"bun-plugin-dts": "^0.2.2"
|
"bun-plugin-dts": "^0.2.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
},
|
}
|
||||||
"dependencies": {
|
|
||||||
"axios": "^1.6.8"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import type { Player } from "../types/player";
|
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.
|
* Get a player by their username or UUID.
|
||||||
*
|
*
|
||||||
@ -7,15 +9,8 @@ import type { Player } from "../types/player";
|
|||||||
* @returns the promised player
|
* @returns the promised player
|
||||||
*/
|
*/
|
||||||
export const getPlayer = (query: string): Promise<Player> => {
|
export const getPlayer = (query: string): Promise<Player> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
resolve({
|
const response: Response = await fetch(`${ENDPOINT}/player/${query}`); // Request the player
|
||||||
uniqueId: "fc1d5fe7-f29b-430d-80bb-3b093a638b0f",
|
resolve((await response.json()) as Player); // Resolve the player
|
||||||
username: "Rainnny",
|
|
||||||
skin: {
|
|
||||||
url: "",
|
|
||||||
model: "default",
|
|
||||||
legacy: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user