Created
March 18, 2016 19:12
-
-
Save ajthemacboy/1d1a73234eeba6632c7c to your computer and use it in GitHub Desktop.
Sucky checker script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mcstatus import MinecraftServer | |
with open('serverlist.txt') as f: | |
for line in f: | |
# If you know the host and port, you may skip this and use MinecraftServer("example.org", 1234) | |
server = MinecraftServer.lookup(line) | |
try: | |
# 'status' is supported by all Minecraft servers that are version 1.7 or higher. | |
status = server.status() | |
print("Server ip: {0}, has {1} players and replied in {2} ms. Version:{3} Motd: {4}".format(line.replace('\n', ' ').replace('\r', ''), status.players.online, status.latency, status.version.name, status.description_clean.encode('utf-8').replace('\n', ' ').replace('\r', ''))) | |
except IOError as e: | |
print("Could not contact server {0}".format(line.replace('\n', ' ').replace('\r', ''))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment