From ed792b4642dc27f66257e697ac3cf5afe9addb5e Mon Sep 17 00:00:00 2001 From: Peter Urda Date: Tue, 16 Sep 2014 12:40:31 -0700 Subject: [PATCH 1/8] Set `usage` to python block --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f2727c2..88b3aa6 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,20 @@ mcstatus provides an easy way to query Minecraft servers for any information the Usage ----- - from mcstatus import MinecraftServer - - server = MinecraftServer("localhost", 25565) - - # 'ping' is supported by all Minecraft servers that are version 1.7 or higher. - status = server.ping_server() - print("The server has %d players" % (status.players.online)) - - # '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. - query = query.query_server() - print("The server has the following players online: " % (string.join(query.players.names, ", "))) +```python +from mcstatus import MinecraftServer + +server = MinecraftServer("localhost", 25565) + +# 'ping' is supported by all Minecraft servers that are version 1.7 or higher. +status = server.ping_server() +print("The server has %d players" % (status.players.online)) + +# '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. +query = query.query_server() +print("The server has the following players online: " % (string.join(query.players.names, ", "))) +``` Installation ------------ @@ -31,4 +33,4 @@ Alternatively, just clone this repo! License ------- -mcstatus is licensed under Apache 2.0. \ No newline at end of file +mcstatus is licensed under Apache 2.0. From 947d1802cdc0adcebc17da7516312bb197b9ad1c Mon Sep 17 00:00:00 2001 From: Peter Urda Date: Tue, 16 Sep 2014 12:42:34 -0700 Subject: [PATCH 2/8] Cleanup intro section --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 88b3aa6..93d019b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ mcstatus ======== -mcstatus provides an easy way to query Minecraft servers for any information they can expose. It provides two modes of access, 'query' and 'ping', the differences of which are listed below in usage. +`mcstatus` provides an easy way to query Minecraft servers for any information they can expose. +It provides two modes of access, `query` and `ping`, the differences of which are listed below in usage. Usage ----- From 9d4c54f6e82684286be9f2aed9fadaa281683a5b Mon Sep 17 00:00:00 2001 From: Peter Urda Date: Tue, 16 Sep 2014 12:42:55 -0700 Subject: [PATCH 3/8] Switch "installation" to bash --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 93d019b..c51123d 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,9 @@ Installation mcstatus is available on pypi, and can be installed trivially with: - pip install mcstatus +```bash +pip install mcstatus +``` Alternatively, just clone this repo! From 43caf72a5931742f9149bcc6084d2f5bd66dcbe3 Mon Sep 17 00:00:00 2001 From: Peter Urda Date: Tue, 16 Sep 2014 12:44:12 -0700 Subject: [PATCH 4/8] query.query_server() doesn't work, fixed README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c51123d..8d7bd40 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ print("The server has %d players" % (status.players.online)) # '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. -query = query.query_server() +query = server.query_server() print("The server has the following players online: " % (string.join(query.players.names, ", "))) ``` From d0d7e01850a9967c947cc547547b87e62bfb73ee Mon Sep 17 00:00:00 2001 From: Peter Urda Date: Tue, 16 Sep 2014 13:07:34 -0700 Subject: [PATCH 5/8] This status call was wrong, in produced a tuple instead. Honestly, ping should be wrapped up into the same variable! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d7bd40..e89e591 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ from mcstatus import MinecraftServer server = MinecraftServer("localhost", 25565) # 'ping' is supported by all Minecraft servers that are version 1.7 or higher. -status = server.ping_server() +status, ping = server.ping_server() print("The server has %d players" % (status.players.online)) # 'query' has to be enabled in a servers' server.properties file. From 7d3c926a3ab679b91b55716f5b57e4312382b6f8 Mon Sep 17 00:00:00 2001 From: Peter Urda Date: Tue, 16 Sep 2014 13:10:08 -0700 Subject: [PATCH 6/8] Use 'format' instead of % --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e89e591..92dc653 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ server = MinecraftServer("localhost", 25565) # 'ping' is supported by all Minecraft servers that are version 1.7 or higher. status, ping = server.ping_server() -print("The server has %d players" % (status.players.online)) +print("The server has {0} players".format(status.players.online)) # '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. From e7ac2f24f6a818a18b512a6e1b3ddd72f17879f2 Mon Sep 17 00:00:00 2001 From: Peter Urda Date: Tue, 16 Sep 2014 13:14:35 -0700 Subject: [PATCH 7/8] Fix bad query example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92dc653..61b8c51 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ print("The server has {0} players".format(status.players.online)) # '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. query = server.query_server() -print("The server has the following players online: " % (string.join(query.players.names, ", "))) +print("The server has the following players online: %s" % (", ".join(query.players.names))) ``` Installation From f07be86a20ce24c8432d625fb50947641a2c2165 Mon Sep 17 00:00:00 2001 From: Peter Urda Date: Tue, 16 Sep 2014 13:15:45 -0700 Subject: [PATCH 8/8] Use 'format' instead of % --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 61b8c51..c3fff58 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ print("The server has {0} players".format(status.players.online)) # '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. query = server.query_server() -print("The server has the following players online: %s" % (", ".join(query.players.names))) +print("The server has the following players online: {0}".format(", ".join(query.players.names))) ``` Installation