Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
MinecraftDiscord/status.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
20 lines (15 sloc)
973 Bytes
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 | |
# If you know the host and port, you may skip this and use MinecraftServer("example.org", 1234) | |
#server = MinecraftServer.lookup("example.org:1234") | |
# 'status' is supported by all Minecraft servers that are version 1.7 or higher. | |
#status = server.status() | |
#print("The server has {0} players and replied in {1} ms".format(status.players.online, status.latency)) | |
# 'ping' is supported by all Minecraft servers that are version 1.7 or higher. | |
# It is included in a 'status' call, but is exposed separate if you do not require the additional info. | |
#latency = server.ping() | |
#print("The server replied in {0} ms".format(latency)) | |
# 'query' has to be enabled in a servers' server.properties file. | |
# It may give more information than a ping, such as a full player list or mod information. | |
def playerStatus(server): | |
query = server.query() | |
return("The server has the following players online: {0}".format(", ".join(query.players.names))) |