Ping both Minecraft Bedrock and Java servers.
Go to file
Timofey Gelazoniya 910184bf5f
refactoring and comments
fix(cli.js): refactor help and error handling logic for better readability and maintainability
feat(cli.js): add support for custom port and timeout options
fix(parallel.js): update list of hosts to ping
fix(bedrock.js): add comments and improve error handling in ping function
fix(java.js): add comments and improve error handling in ping function
fix(varint.js): add comments to functions and improve readability
fix(index.d.ts): export all functions from java.js and bedrock.js
fix(lib/bedrock.d.ts): update source link
fix(lib/java.d.ts): update source link
2023-10-22 21:32:00 +03:00
example refactoring and comments 2023-10-22 21:32:00 +03:00
lib refactoring and comments 2023-10-22 21:32:00 +03:00
types refactoring and comments 2023-10-22 21:32:00 +03: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 update readme 2022-08-23 16:22:42 +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 update version from 1.0.4 to 1.1.0 2023-10-22 02:29:54 +03:00

README.md

mineping

mineping is a Javasript library thar provides Minecraft server ping protocol implementation. It can be used to collect information about the server, such as MODT, current online, server icon (java edition only) and etc.

Mirror on my Git

Requirements

Node.js 14 or newer is required

Install

npm i @minescope/mineping

Loading and configuration the module

ES Modules (ESM)

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

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