acollierr17 / Minecraft-API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

minecraft-api

minecraft-api is a simple wrapper around the Minecraft API. The package is really lightweight and does use Promises as return type.

Installation

npm install --save minecraft-api

Usage

MinecraftAPI.uuidForName(username)

Parameters:

  • username: The username to resolve the UUID for

Example:

const MinecraftAPI = require('minecraft-api');

function foo() {
    MinecraftAPI.uuidForName('jeb_')
        .then(uuid => console.log(uuid))
        .catch(err => console.log(err))
}

Example (async/await):

const MinecraftAPI = require('minecraft-api');

async function foo() {
    try{
        const uuid = await MinecraftAPI.uuidForName('jeb_');
        console.log(uuid);
    } catch(err){
        console.error(err);
    }
}

About


Languages

Language:TypeScript 100.0%