New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

minecraft-query

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minecraft-query

A Node.js implementation of Minecraft's query protocol

latest
Source
npmnpm
Version
1.0.13
Version published
Maintainers
1
Created
Source

query

A Node.js implementation of Minecraft's query protocol

Installation

npm install minecraft-query

Prerequisites

You will first have to configure your server to recieve queries from clients.
To do so, set the enable-query flag to true in your server.properties file and then set the query.port flag as you wish.
The configuration should look like this

...
enable-query=true
query.port=<1-65535>
...

Example use

const Query = require("minecraft-query");

const q = new Query({host: 'localhost', port: 9630, timeout: 7500});

q.fullStat()
  .then(success => {

    console.log(success);

    return q.basicStat()

  })

  .then(success => {

    console.log(success);

    q.close();

  })

API

class Query({host, port, timeout})

Arguments:
  • host: the address of the server
  • port: the query port of the server
  • timeout: handshake timeout in ms (default 5000)

It returns a Query instance.

Query#basicStat()

Arguments:
  • none

A promise that returns an object that corresponds to the basic stat query type. The object should look like this:

{ 
  motd: 'MOTD here',
  gametype: 'SMP',
  map: 'world',
  online_players: '0',
  max_players: '20' 
}

Query#close()

Arguments:
  • none

It ends the connection

Query#fullStat()

Arguments:
  • none

A promise that returns an object that corresponds to the full stat query type. The object should look like this:

{ 
  motd: 'MOTD here',
  gametype: 'SMP',
  game_id: 'MINECRAFT',
  version: '1.14.2',
  plugins: 'Paper on 1.14.2-R0.1-SNAPSHOT',
  map: 'world',
  online_players: '4',
  max_players: '20',
  port: '9630',
  players: ['macca_ferri', 'player1', 'notch', 'jeb'] 
}

Keywords

Minecraft

FAQs

Package last updated on 27 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts