npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minecraft-ping-ffix

v1.0.1

Published

sends pings to Minecraft servers of various versions

Downloads

3

Readme

node-minecraft-ping

Sends a server list ping packet to Minecraft servers

Usage:

require('minecraft-ping').ping_fe01fa({host:'localhost', port:25565}, function(err, response) {
  console.log(err, response);
});

Several pings are supported. Version compatibility:

| Minecraft Version | ping_fe01fa | ping_fe01 | ping_fe | Netty status ping(*) | ------------- | ------------- | ------------- | ------------- | ------------- | 1.9 | YES | YES | Limited | YES | 1.8.9 | YES | YES | Limited | YES | 1.7.10 | YES | YES | Limited | YES | 1.6.4 | YES | Slow | Limited, Slow | NO | 1.5.2 | YES | YES | Limited, Slow | NO | 1.4.4 | YES | YES | Limited, Slow | NO | 1.3.2 | NO | Limited | Limited | NO | 1.2.5 | NO | Limited | Limited | NO | earlier | NO | maybe | probably | NO

(*) As implemented in node-minecraft-protocol src/ping.js

(**) Limited = responds but does not return the game/protocol version

Example:

node demo.js localhost 25565

ping_fe01fa

ping_fe01fa is the best general-purpose ping for most use cases, where a fast response and reasonable version compatibility is required. It includes MC|PingHost, for efficient 1.6.4 compatibility (but ≤1.3.2 incompatibility). You can use it on old servers starting with 1.4.4 at the earliest, then 1.5.2 and 1.6.4, and it even works on Netty-based 1.7.10, 1.8.9, and 1.9 servers. The protocol and game version is included in the ping so you can tell what protocol to speak to it. Example responses from ping_fe01fa:

{
  pingVersion: 1,
  protocolVersion: 78,
  gameVersion: '1.6.4',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2
}

{
  pingVersion: 1,
  protocolVersion: 61,
  gameVersion: '1.5.2',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2
}

{
  pingVersion: 1,
  protocolVersion: 49,
  gameVersion: '1.4.4',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2
}

ping_fe01fa does not support 1.3.2 and 1.2.5. If you need to be compatible with older versions, see ping_fe01, ping_fe, and/or ping_fefd_udp.

ping_fe01fa is also exported as ping, since it is expected to be the most commonly used ping type.

ping_fe01

ping_fe01 is similar to ping_fe01fa, but without the MC|PingHost channel. The missing MC|PingHost means it will respond slowly on 1.6.4 servers, but this has the advantage of not confusing 1.3.2 and 1.2.5 servers with the extra data.

However, 1.3.2 and 1.2.5 servers respond only with limited information (no protocol payload, only server message of the day description, number of online players, and maximum player count). 1.7.10 and above will respond quickly and include the full response, including protocol version.

If you need to support arbitrarily old versions, but do not mind the slow 1.6.4 response (for example, if you're sending a batch of ping requests over a long period of time), ping_fe01 may be a good choice.

ping_fe

ping_fe sends nothing more than a single 0xfe byte, and only returns motd, playersOnline, and maxPlayers. No protocol or game version. However it works even on 1.2.5 and 1.3.2. It will also work on 1.4.4, 1.5.2, and 1.6.4, but is noticeably slower than ping_fe01. On 1.7.10, 1.8.9, and 1.9 it responds quicker, but still lacks the protocol information also returned in ping_fe01.

If all you need is the server description, and do not mind the slowness of 1.6.4/1.5.2/1.4.4, consider ping_fe. It is not very useful in most situations, better served by ping_fe01fa or ping_fe01.

ping_fefd_udp

ping_fefd_udp is a multi-step UDP-based query protocol described in 2011 at https://dinnerbone.com/blog/2011/10/14/minecraft-19-has-rcon-and-query (for Minecraft 1.9 beta).

require('minecraft-ping').ping_fefd_udp({host:'localhost', port:25565}, function(err, response) {
  console.log(err, response);
});

Example response from ping_fefd_udp:

{ worldHeight: 128,
  motd: 'A Minecraft Server',
  gameType: 'SMP',
  gameName: 'MINECRAFT',
  gameVersion: '1.5.2',
  plugins: 'CraftBukkit on Bukkit 1.5.2-R1.1-SNAPSHOT: MultiWorld 4.5.4; SilkSpawners 3.2.2; OpenInv 2.0.2; EnchantMore 2.0; WorldEdit 5.5.6',
  defaultWorld: 'world',
  numPlayers: 0,
  maxPlayers: 20,
  port: 25565,
  host: '0.0.0.0'
}

It can be used to query modified servers, such as CraftBukkit, in order to get their installed plugins. Unlike the fe pings, it does not include the protocol version, though it does include the game version.

On vanilla servers, support can be enabled by setting enable-query=true in server.properties (and optionally query.port, which defaults to the same as server-port). If enabled, the server will log:

2016-01-30 11:28:10 [INFO] Starting GS4 status listener
2016-01-30 11:28:11 [INFO] Setting default query port to 25565
2016-01-30 11:28:11 [INFO] Query running on 0.0.0.0:25565

where GS4 is apparently the "GameSpy4" protocol. Since it is off by default, you'll probably not need to use ping_fefd_udp except in very specialized situations.

ping_all

ping_all sends all of the types of pings, and calls the callback multiple times. You can get the ping type with the third argument in the callback function.

Note: synchronizing and waiting for each of the pings is currently out of the scope of this module (see https://github.com/deathcap/node-minecraft-ping/issues/4), in general it is preferrable to use only one ping type (suggestion: ping_fe01fa).

License

MIT