0.1.5 • Published 3 years ago

nodejs-minecraftquery v0.1.5

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

codecov

Server config

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

Installation

# using npm:
$ npm i nodejs-minecraftquery --save

# using yarn:
$ yarn add nodejs-minecraftquery

Import

/* Using CommonJS */
const { MinecraftQuery } = require('nodejs-minecraftquery')

/* Using EsModules */
import { MinecraftQuery } from 'nodejs-minecraftquery'

Methods

/* Default argument */
{
  address: string, // Required
  port?: number    // Optional, default is 25565
}

Static MinecraftQuery.Basic(server)

Usage

const server: Server = {
  address: '127.0.0.1'
}

const info = await MinecraftQuery.Basic(server)

console.log({ info })

Output

/* Output type */
{
  motd: string
  gameType: string
  map: string
  numPlayers: number
  maxPlayers: number
}
/* Example output */
{
  motd: 'A Minecraft Server'
  gameType: 'SMP'
  map: 'world'
  numPlayers: 5
  maxPlayers: 100
}

Static MinecraftQuery.Full(server)

Usage

const server: Server = {
  address: '127.0.0.1'
}

const info = await MinecraftQuery.Full(server)

console.log({ info })

Output

/* Output type */
{
  motd: string
  gameType: string
  gameId: string
  version: string
  plugins: string[] | null
  map: string
  numPlayers: number
  maxPlayers: number
  players: string[]
}
/* Example output */
{
  motd: 'A Minecraft Server'
  gameType: 'SMP'
  gameId: 'MINECRAFT'
  version: '1.2.5'
  plugins: ['WorldEdit 5.3', 'CommandBook 2.1']
  map: 'world'
  numPlayers: 5
  maxPlayers: 100
  players: ['player1', 'player2','player3'...]
}

License

MIT

0.1.5

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago