mirror of
https://github.com/Dinnerbone/mcstatus.git
synced 2026-04-06 03:51:23 +08:00
Set usage to python block
This commit is contained in:
28
README.md
28
README.md
@@ -6,18 +6,20 @@ mcstatus provides an easy way to query Minecraft servers for any information the
|
|||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
from mcstatus import MinecraftServer
|
```python
|
||||||
|
from mcstatus import MinecraftServer
|
||||||
server = MinecraftServer("localhost", 25565)
|
|
||||||
|
server = MinecraftServer("localhost", 25565)
|
||||||
# 'ping' is supported by all Minecraft servers that are version 1.7 or higher.
|
|
||||||
status = server.ping_server()
|
# 'ping' is supported by all Minecraft servers that are version 1.7 or higher.
|
||||||
print("The server has %d players" % (status.players.online))
|
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' has to be enabled in a servers' server.properties file.
|
||||||
query = query.query_server()
|
# It may give more information than a ping, such as a full player list or mod information.
|
||||||
print("The server has the following players online: " % (string.join(query.players.names, ", ")))
|
query = query.query_server()
|
||||||
|
print("The server has the following players online: " % (string.join(query.players.names, ", ")))
|
||||||
|
```
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
@@ -31,4 +33,4 @@ Alternatively, just clone this repo!
|
|||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
mcstatus is licensed under Apache 2.0.
|
mcstatus is licensed under Apache 2.0.
|
||||||
|
|||||||
Reference in New Issue
Block a user