minecraft-server-info
Version:
Package na wyświetlanie informacji na temat serwera minecraft
35 lines (23 loc) • 1.33 kB
Markdown
# minecraft-server-info
This project is a simple Node.js module that allows you to check the status of Minecraft servers.
## Installation
To install this module, use the following command:
```npm install --save minecraft-server-info```
## Usage example
Below is an example of how to check the status of a Minecraft server:
```javascript
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:
```javascript
console.log(res['players.online'])
```
## Available fields
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.