Skip to main content

A lightweight Minecraft client to query the status of a Minecraft server

Project description

MCClient

Downloads

A lightweight Minecraft client to query the status of a Minecraft server.

Supported Mincraft versions

  • Minecraft Java (1.4.* -> 1.19.*)
  • Minecraft Bedrock

Supported protocols

Installation

pypi

pip install mcclient-lib

The pypi package might not always be up to date.

Usage

ServerListPing

from mcclient import SLPClient

# for Minecraft Java servers from 1.7.*
slp_client = SLPClient("mc.example.com", port=12345)
res = slp_client.get_status()

Query

from mcclient import QueryClient

# for Minecraft Java servers (needs to be enabled on the server)
query_client = QueryClient(mc.example.com, port=12345)
res = query_client.get_status()

Bedrock ServerListPing

from mcclient import BedrockSLPClient

# for Minecraft Bedrock servers
bedrock_slp_client = BedrockSLPClient(mc.example.com, port=12345)
res = bedrock_slp_client.get_status()

Response

How to handle the returned response object

motd = res.motd

online_players = res.players.online
max_players = res.players.max
player_list = res.players.list

version = res.version.name
protocol_version = res.version.protocol

# only for query responses
plugins = res.plugins

# only for basic ServerListPing
has_favicon = res.favicon

# only for query and Bedrock
gametype = res.gametype

# only for query and bedrock
map = res.map

# only for bedrock
server_id = res.server_id

Queryable data

  • motd
  • online player count
  • max player count
  • player list
  • server version
  • server protocol version
  • mods and plugins
  • has a favicon
  • name of map
  • hostport and hostip
  • gametype
  • server id Note: not every field is queryable with every protocol

Documentation

There is some documentation here, if that isn't enough just look into the source.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcclient-lib-0.8.10.tar.gz (9.0 kB view hashes)

Uploaded Source

Built Distribution

mcclient_lib-0.8.10-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page