A lightweight Minecraft client to query the status of a Minecraft server
Project description
MCClient
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
- ServerListPing for Minecraft java servers
- Legacy ServerListPing for Minecraft java servers before 1.4
- Query Protocol for Minecraft java servers (this needs to be enabled on the server)
- Bedrock ServerListPing for Bedrock servers
Installation
pypi
pip install mcclient-lib
Note: The pypi package isn't always up to date. If you want to use the latest version you will have to clone this repository and install the package locally.
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
# 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_dict = 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, just look into the source if that isn't enough.
Project details
Release history Release notifications | RSS feed
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.14.tar.gz
(12.2 kB
view hashes)
Built Distribution
Close
Hashes for mcclient_lib-0.8.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59180503433724e6fce93969550d385f97e58ee79bc9726151dae4854951d4cf |
|
MD5 | 45c11854bf7369d5c0be8d8753440d86 |
|
BLAKE2b-256 | 1703100e223d7a02d10fc67ef5a0cf08bb1ba59bf94a71a0378254559ffbd59c |