# mc-hermes

> Node module for pinging minecraft PC and PE servers

Latest version **0.1.5** (published 2017-08-25) · 0 weekly downloads

## Install

```sh
npm install mc-hermes
pnpm add mc-hermes
yarn add mc-hermes
bun add mc-hermes
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2017-08-25 |
| First published | 2017-08-04 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | ArcticZeroo |
| Maintainers | arcticzeroo |
| Keywords | minecraft, ping, utilities, minecraft pc, minecraft pe, pc, pe |

## Links

- npm: https://www.npmjs.com/package/mc-hermes
- Repository: https://github.com/ArcticZeroo/mc-hermes
- Homepage: https://github.com/ArcticZeroo/mc-hermes#readme
- Issues: https://github.com/ArcticZeroo/mc-hermes/issues
- npm.io page: https://npm.io/package/mc-hermes

## Dependencies (1)

- [bytebuffer](https://npm.io/package/bytebuffer.md) ^5.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.5 (latest) — 2017-08-25
- 0.1.4 — 2017-08-24
- 0.1.3 — 2017-08-11
- 0.1.2 — 2017-08-11
- 0.1.1 — 2017-08-11
- 0.1.0 — 2017-08-04

## README

# mc-hermes

This is a library to ping both `pc` and `pe` servers.

The library uses a significant portion of both [mc-ping-updated](https://github.com/Cryptkeeper/mc-ping-updated) and [mcpe-ping](https://github.com/Falkirks/mcpe-ping). Thanks to both of you for the base code. 

I've essentially just cleaned up a few bits, converted all parameters to a single object, somewhat standardized the response, and made it use promises instead of callbacks.

As said prior, all parameters are just a single object passed as the only argument.

Valid parameters are `server` (the hostname/ip), `port` (the port, duh), `timeout` (time in ms for the ping to time out), `type` (if not using `ping.pe` or `ping.pc`), and `protocol` (protocol version to use if pinging PC). 

Only `server` is required, and `type` defaults to pc.

Usage:

```javascript
const ping = require('mc-hermes');

// PE Ping
ping({
    type: 'pe',
    server: 'pe.mineplex.com'
})
    .then((data)=>{
        console.log(`Online players: ${data.players.online}`);
    })
    .catch(console.error);

// PC Ping
ping({
    type: 'pc',
    server: 'us.mineplex.com'
})
    .then((data)=>{
        console.log(`Online players: ${data.players.online}`);
    })
    .catch(console.error);

// Also a PC ping
ping.pc({ server: 'us.mineplex.com' })
    .then((data)=>{
        console.log(`Online players: ${data.players.online}`);
    })
    .catch(console.error);
```

For both PC and PE, a successful resolution will pass a JSON object as documented here: [http://wiki.vg/Server_List_Ping#Response](http://wiki.vg/Server_List_Ping#Response)

PE does not have a few fields that PC does, such as the favicon. However, `version.name`, `players.max`, `players.online`, and `description` exist for both PC and PE, to provide a somewhat consistent format to find player counts across the two platforms.

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