This project is a simple Node.js module that allows you to check the status of Minecraft servers.
To install this module, use the following command:
npm install --save minecraft-server-info
Below is an example of how to check the status of a Minecraft server:
const mc = require('minecraft-server-info');
mc.status({ type: 'java', ip: 'hypixel.net', port: 25565, show: ['online', 'players.online'], }) .then((res) => console.log(res)) .catch((err) => console.log(err));
In the above example the status
function will be called with a configuration object that specifies the type
of the server (java
or bedrock
), the ip
of the server, the port
of the server and the show
array that specifies which fields should be shown in the result.
But you can also display for example only the number of players via:
console.log(res['players.online'])
Possible fields to display are:
-
online
: whether the server is online -
players.online
: the number of players online -
players.max
: the maximum number of players that can connect at the same time -
favicon
: a link to the server icon
...and many others, it all depends on what the Minecraft server returns.