Ping both Minecraft Bedrock and Java servers.
Go to file
Egornya d9bf4cfb3f feat(pingJava): add `protocolVersion`
feat(types): `PingOptions` for Java

fix(types): type names

fix(types): type names
2023-12-08 16:04:35 +04:00
example fix(parallel.js): add break statement to stop iterating over results if a promise is rejected 2023-10-22 21:38:34 +03:00
lib feat(pingJava): add `protocolVersion` 2023-12-08 16:04:35 +04:00
types feat(pingJava): add `protocolVersion` 2023-12-08 16:04:35 +04:00
.gitignore initial commit 2022-01-10 23:21:47 +03:00
LICENSE initial commit 2022-01-10 23:21:47 +03:00
README.md docs(README.md): improve clarity and grammar in the project description 2023-10-22 22:49:53 +03:00
SECURITY.md initial commit 2022-01-10 23:21:47 +03:00
index.js initial commit 2022-01-10 23:21:47 +03:00
package.json chore(package.json): update version from 1.1.0 to 1.1.1 2023-10-22 21:32:33 +03:00

README.md

mineping

This JavaScript library provides an implementation of the Minecraft server ping protocol. It allows you to gather information about a Minecraft server, such as the MOTD, current online players, server icon (Java Edition only), and more.

Mirror on my Git

Requirements

Node.js 14 or newer is required

Install

To install mineping, simply run the following command:

npm i @minescope/mineping

Loading and configuration the module

ES Modules (ESM)

If you are using ES Modules, you can import the library like this:

import { pingJava, pingBedrock } from '@minescope/mineping';

CommonJS

mineping is an ESM-only module — you are not able to import it with require(). If you cannot switch to ESM, you can use the async import() function from CommonJS to load mineping asynchronously:

const pingJava = (...args) => import('@minescope/mineping').then(module => module.pingJava(...args));
const pingBedrock = (...args) => import('@minescope/mineping').then(module => module.pingBedrock(...args));

Usage

Ping a Java server with default options:

import { pingJava } from '@minescope/mineping';

const data = await pingJava('mc.hypixel.net');
console.log(data);

Ping a Bedrock server with custom options:

import { pingBedrock } from '@minescope/mineping';

const data = await pingBedrock('mco.mineplex.com', {
    port: 19132,
    timeout: 500
});
console.log(data);

More complex example can be found in the example folder!

Acknowledgements

Special thanks to the following projects:

  • mcping crate for Rust
  • mcping-js library for quering Minecraft Java Edition servers