Skip to main content

A lightweight Minecraft client for querying the status data of a Minecraft server.

Project description

MCClient-lib

Downloads PyPI

A lightweight Minecraft client for querying the status data of a Minecraft server.

Supported Mincraft versions

  • Minecraft Java (v1.4.0 and later)
  • Minecraft Bedrock

Supported protocols

Installation

pypi

pip3 install mcclient-lib

pip + github

You can also install the package directly from github.

pip3 install git+https://github.com/Sch8ill/MCClient-lib.git

Usage

ServerListPing

from mcclient import SLPClient

# for Minecraft Java servers from 1.7.* and newer
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

# The server address and port
host = res.host
port = host.port

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

# timestamp of the request
timestamp = res.timestamp

# the reponse as a dictonary with some further infomation
# the keys are named like the values in the response object
res_dictionary = res.res

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

You can find more documentation here, feel free to look into the source if you can't find enough.

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-1.0.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

mcclient_lib-1.0.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file mcclient-lib-1.0.0.tar.gz.

File metadata

  • Download URL: mcclient-lib-1.0.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for mcclient-lib-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2345031ee2271c71a0122a82adc2d611f32247cfb25e36d82dbc58ba4efccd79
MD5 a45c2f3719a25df16964df5b9ab1f1d5
BLAKE2b-256 4cfe0e464bfbb202d450f1060c0b69af519f2e1c92195389125ad11f76cdae2a

See more details on using hashes here.

File details

Details for the file mcclient_lib-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mcclient_lib-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for mcclient_lib-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c056890d8525617ae177b86466db4472b3e2fd656c179c30ca6673ca5f9d9f2c
MD5 4b991810ea88b66f3f6b3d9756b35bd3
BLAKE2b-256 aae04543971de459934ae6c445f4f7c4fe9e309b9f158aa49dcd123c35ece66f

See more details on using hashes here.

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