# bedrock-api

> A Node.js library to retrieve information about a Minecraft Bedrock Edition server using its IP address and port.

Latest version **1.0.0** (published 2023-09-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install bedrock-api
pnpm add bedrock-api
yarn add bedrock-api
bun add bedrock-api
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-09-17 |
| First published | 2023-09-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 20.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | JblusItsMe |
| Maintainers | jblusitsme |
| Keywords | mcpe, mcpe-ping, bedrock-ping, bedrock-api, mcbe, minecraft |

## Links

- npm: https://www.npmjs.com/package/bedrock-api
- npm.io page: https://npm.io/package/bedrock-api

## Dependencies (4)

- [dns](https://npm.io/package/dns.md) ^0.2.2
- [dgram](https://npm.io/package/dgram.md) ^1.0.1
- [bytebuffer](https://npm.io/package/bytebuffer.md) 5.0.1
- [portfinder](https://npm.io/package/portfinder.md) 1.0.32

## Recent versions

- 1.0.0 (latest) — 2023-09-17

## README

# BedrockAPI

The `bedrock-api` Node.js library is a powerful tool for both developers and Minecraft enthusiasts. It provides a simple and efficient way to obtain detailed information about a Minecraft Bedrock Edition server using only its IP address and port. With this library, you can access vital server statistics, player data, and more, making it an essential component for any Minecraft server monitoring or management system.

### Key Features:

**Server Information:** Retrieve essential details about the Minecraft Bedrock server, including its version, MOTD *(Message of the Day)*, IP address, ID *(ping, server)*, and server name.

**Player Data:** Obtain the number of online players and the maximum number of players that the server can accommodate, enabling you to monitor player activity in real-time.

**Server Status**: Quickly check if the server is online and responsive, helping you ensure the availability of your Minecraft world.

---
[Apache License](https://github.com/JblusItsMe/bedrockApi/blob/main/LICENSE)


## Documentation
```javascript
const API = require('bedrock-api');
const api = new API();
const ip = 'play.nethergames.org';
const port = 19132;
```
[Read our full documentation](https://github.com/JblusItsMe/bedrockApi/wiki)


## Installation

Install with npm

```bash
  npm install bedrock-api
```

## API Reference

#### Get all data

```http
  .ping(ip, port, callback, timeout){}
```

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| `ip` | `string` | **Required**. Your server adress. |
| `port` | `number` | **Required**. Your server port. |
| `callback` | `function` | **Required**. Function(err, res){} |
| `timeout` | `number` | **Optional**. Response ping (default: 5000). |

#### Get item

```http
  .isOnline(ip, port, callback){}
  .getAckId(ip, port, callback){}
  .getMaxOnline(ip, port, callback){}
  .getOnline(ip, port, callback){}
  .getCleanName(ip, port, callback){}
  .getName(ip, port, callback){}
  .getVersion(ip, port, callback){}
  .getGame(ip, port, callback){}
  .getPingId(ip, port, callback){}
  .getServerId(ip, port, callback){}
  .getIp(ip, port, callback){}
  .getIpFamilly(ip, port, callback){}
```

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| `ip` | `string` | **Required**. Your server adress. |
| `port` | `number` | **Required**. Your server port. |
| `callback` | `function` | **Required**. Function(error, result){} |


## Demo

https://github.com/JblusItsMe/bedrockApi/tree/main/test

---
_Source: https://npm.io/package/bedrock-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
