1.14.2 • Published 4 years ago

hive-api v1.14.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Hive-Api-Node

A node.js wrapper for the api of https://hivemc.com, written in TypeScript.

Install

$ npm install hive-api

Documentation

https://lergin.github.io/hive-api/

Usage

JavaScript

const hive = require('hive-api');

let player = new hive.Player("Lergin_");

player.info().then(info => {
    console.log(`Tokens: ${info.tokens}`)
});

TypeScript

import {Player} from "hive-api";

let player: Player = new Player("Lergin_");

player.info().then((info: PlayerInfo) => {
    console.log(`Tokens: ${info.tokens}`)
});

Examples

Some examples are using async / await and therefor need to be wrapped into a async function. See: async_function

Print the unique players of each game

import {GameTypes, GameType} from "hive-api";

await GameTypes.update(); // update the list of GameTypes

GameTypes.list.forEach((type: GameType) => {
    type.uniquePlayers().then((players) => {
        console.log(`${type.name}: ${players} players`);
    });
});

Get the global achievements of the winner of the latest survival games game

import {GameTypes, Game, SgGameInfo, PlayerInfo, ServerAchievement, AchievementInfo} from "hive-api";

GameTypes.SG.latestGames()
    .then(games => games[0])
    .then((game: Game) => game.info())
    .then(async (gameInfo: SgGameInfo) => {
        let winnerInfo: PlayerInfo = await gameInfo.winner.info();

        winnerInfo.achievements.forEach((achievement: ServerAchievement) =>{
            achievement.info().then((info: AchievementInfo) => info.name)
            .then(console.log)
        });
    }).catch(console.error);

List the names of the skywars maps

import {GameTypes, GameMap} from "hive-api";

GameTypes.SKY.maps()
    .then((maps: GameMap[]) => maps.map((map: GameMap) => map.worldName))
    .then(console.log)

Get the amount of Beds destroyed by Malte662 in Bedwars

import {Player, BedPlayerGameInfo, GameTypes} from "hive-api"

let player: Player = new Player("Lergin_");

let playerBedInfo: BedPlayerGameInfo = (await player.gameInfo(GameTypes.BED)) as BedPlayerGameInfo;

console.log(playerBedInfo.bedsDestroyed);

There might be some more informations in the forums of HiveMC: https://forum.hivemc.com/threads/node-js-hive-api-library.279776/

1.14.2

4 years ago

1.14.1

4 years ago

1.14.0

4 years ago

1.13.10

4 years ago

1.13.9

5 years ago

1.13.8

5 years ago

1.13.7

5 years ago

1.13.6

5 years ago

1.13.5

5 years ago

1.13.4

5 years ago

1.13.3

5 years ago

1.13.2

5 years ago

1.13.1

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.1

5 years ago

1.11.0

6 years ago

1.10.0

6 years ago

1.9.0

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.3

6 years ago

1.7.2

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.0

6 years ago

1.2.7

6 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago