A lightweight Minecraft client for querying the status data of a Minecraft server.
Project description
MCClient-lib
A lightweight Minecraft client for querying the status data of a Minecraft server.
Supported Minecraft versions
- Minecraft Java (v1.4.0 and later)
- 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 Minecraft Bedrock servers
Installation
pip
pip install mcclient-lib
Usage
ServerListPing
from mcclient import SLPClient
# for Minecraft Java servers from version 1.7.0 and later
slp_client = SLPClient("mc.example.com")
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")
res = query_client.get_status()
Bedrock ServerListPing
from mcclient import BedrockSLPClient
# for Minecraft Bedrock servers
bedrock_slp_client = BedrockSLPClient("mc.example.com")
res = bedrock_slp_client.get_status()
Response
How to handle the returned response object
print(f"host: {res.host}")
print(f"port: {res.port}")
print(f"motd: {res.motd}")
print(f"online players: {res.players.online}")
print(f"max players: {res.players.max}")
print(f"players list: {res.players.list}")
print(f"version: {res.version.name}")
print(f"protocol version: {res.version.protocol}")
print(f"timestamp: {res.timestamp}")
print(f"favicon: {res.favicon is not None}")
# only for query and Bedrock responses
print(f"gametype: {res.gametype}")
print(f"map: {res.map}")
# only for query responses
print(f"plugins: {res.plugins}")
print(f"host ip: {res.hostip}")
print(f"host port: {res.hostport}")
# only for bedrock responses
print(f"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 the map
- Hostport and hostip
- Gametype
- Server ID
Note that 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
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-1.1.1.tar.gz
(12.4 kB
view details)
Built Distribution
File details
Details for the file mcclient_lib-1.1.1.tar.gz
.
File metadata
- Download URL: mcclient_lib-1.1.1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d966eab694807c26788697a1f1728956c6d461e517b8dc75b002733813e498ea |
|
MD5 | e3da7217f86435cb0cf8fe4e447e06f5 |
|
BLAKE2b-256 | d308398342c7a387168f054d7dc50f4d2bbc02eb91ae2e675c160c6dd40ad67d |
File details
Details for the file mcclient_lib-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: mcclient_lib-1.1.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cac164f49611d800ed41fbc729f6a6d7b9002f9f293567fafeedcc304334064a |
|
MD5 | 0d6158e013854adb1d39ea25e26a35c7 |
|
BLAKE2b-256 | 401ce9f994623705fd0d13ccea8dccf7893824cd2e3df1c14a9312d261f09601 |