2024-04-14 20:14:42 +00:00
|
|
|
# Minecraft Utilities - Javascript Library
|
2024-04-14 20:11:04 +00:00
|
|
|
|
2024-04-14 20:14:42 +00:00
|
|
|
The JavaScript library for the Minecraft Utilities API.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Install the package using npm:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm install mcutils-library
|
|
|
|
```
|
|
|
|
|
2024-04-15 08:02:07 +00:00
|
|
|
Get player:
|
2024-04-14 20:14:42 +00:00
|
|
|
|
|
|
|
```javascript
|
2024-04-15 08:02:07 +00:00
|
|
|
import { getPlayer } from "mcutils-library";
|
|
|
|
|
|
|
|
const cachedPlayer = await getPlayer(playerId);
|
|
|
|
const { player } = cachedPlayer;
|
2024-04-14 20:14:42 +00:00
|
|
|
|
|
|
|
console.log(player);
|
|
|
|
```
|
2024-04-15 08:02:07 +00:00
|
|
|
|
|
|
|
Get Server:
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
import { getServer } from "mcutils-library";
|
|
|
|
import JavaMinecraftServer from "mcutils-library/dist/types/server/javaServer";
|
|
|
|
|
|
|
|
const cachedServer = await getServer(ServerPlatform.Java, "hypixel.net");
|
|
|
|
const { server } = cachedServer;
|
|
|
|
|
|
|
|
console.log(server);
|
|
|
|
```
|