1.2.0 • Published 2 years ago

node-minecraft-status v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

minecraft-status

npm license

A observable-based Minecraft server status for Node.js

Installing :package:

npm i node-minecraft-status

Usage :rocket:

Sample

import { PingContext } from 'node-minecraft-status';

const client = new PingContext();

client.ping('hypixel.net')
  .subscribe({
    next(response) {
      console.log(response);
    },
    error(err) {
      console.error(err);
    },
    complete() {
      console.log('pong!');
    },
  });

Ping Client

MethodDescription
pingGet server information via ping protocol.
setStrategySet the way to create the handshake package and parse the server response.
setTimeoutSet socket timeout.

ping

ParameterTypeDescriptionRequired
addressStringThe server hostname or server hostname with port ([host]:[port])Yes
portNumberThe server port. (defaults: 25565)

setStrategy

ParameterTypeDescriptionRequired
strategyObjectThe instance of strategy.Yes

setTimeout

ParameterTypeDescriptionRequired
timeoutNumberThe socket timeout.Yes

Ping Response

{
  host: string,         // resolved hostname
  port: number,         // resolved port
  ip?: string,          // when received domain name
  version?: {
    name: string,
    protocol: string,
  },                    // only 1.6+
  players: {
    max: number,
    online: number,
    sample?: {
      id: string,
      name: string,
    },                  // only 1.6+
  },
  description: string,  // string if < 1.6, if 1.6 < an object like chat (see: https://wiki.vg/Chat)
  favicon?: string,     // only 1.6+
}

TODO :memo:

  • ping
  • support legacy versions (< 1.6)
  • resolving srv records
  • server latency
  • formatting response
  • query

License :page_with_curl:

The MIT License. See LICENSE file.

1.2.0

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago