A collection of utilities for interacting with Minecraft servers.
A tool to extract the client jar file.
from utils import extractor
#extract the client jar file
print("Downloading and extracting the client...")
extractor_obj = extractor.Extractor("1.16.5")
extracted_path = extractor_obj.extract_jar()
print("Client extracted to:", extracted_path)
#get a list of death messages
death_messages = extractor_obj.get_death_messages()
Interface with the Minecraft RCON protocol.
from utils import rcon
#send a command to the local server
rcon = rcon.RCON("127.0.0.1", 25575, "password")
#returns a string with the command's output
output = rcon.send_cmd("list")
print(output)
rcon.close()
Interface with the Minecraft query protocol.
from utils import query
#query the local server
query_obj = query.Query(("127.0.0.1", 25565))
#retuns a dict with some stats
full_stat = query_obj.full_stat()
basic_stat = query_obj.basic_stat()
print(full_stat)
Ping any Minecraft server above version 1.7.
from utils import ping
#ping the local server
pinger = ping.Pinger(("127.0.0.1", 25565))
#retuns a dict with some stats
stats = pinger.ping()
print(stats)
Generate a nearly pixel-perfect image of what a server would look line in the client's server list.
You need to have Pillow installed for this to work (pip3 install Pillow
).
from utils import motd_renderer
#renders an image of the server's motd and icon
renderer = motd_renderer.MOTDRenderer()
#returns a PIL image object
image = renderer.get_full_image(title="Hypixel", address=("mc.hypixel.net", 25565))
image.save("/tmp/img.png", "PNG")
Generated image: