mirror of
https://github.com/JonasunderscoreJones/Minecraft-server-Status.git
synced 2025-10-22 18:29:17 +02:00
Added port free status capabilities
Added port free status capabilities and 3 second delay between checks.
This commit is contained in:
parent
424f47b60d
commit
345bdc8085
1 changed files with 45 additions and 0 deletions
45
cmd-v0.5.py
Normal file
45
cmd-v0.5.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
from mcstatus import JavaServer
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
ip = input("Please Enter server IP: ")
|
||||||
|
port = input("Enter Port (press enter for default port 25565, enter 0 if unknown): ")
|
||||||
|
|
||||||
|
if port == "":
|
||||||
|
port = "25565"
|
||||||
|
|
||||||
|
if port == "0":
|
||||||
|
server = JavaServer.lookup(ip)
|
||||||
|
else:
|
||||||
|
server = JavaServer.lookup(ip + ":" + port)
|
||||||
|
|
||||||
|
if port == "0":
|
||||||
|
while True:
|
||||||
|
status = server.status()
|
||||||
|
query = server.query()
|
||||||
|
print("---------- " + ip + " ----------")
|
||||||
|
print(f"version: v{status.version.name} (protocol {status.version.protocol})")
|
||||||
|
print(f'description: "{status.description}"')
|
||||||
|
|
||||||
|
print(f"host: {query.raw['hostip']}:{query.raw['hostport']}")
|
||||||
|
print(f"software: v{query.software.version} {query.software.brand}")
|
||||||
|
print(f"plugins: {query.software.plugins}")
|
||||||
|
print(f"players: {status.players.online}/{status.players.max}")
|
||||||
|
print(f"Players Online: {query.players.names}")
|
||||||
|
print("\n")
|
||||||
|
wait(3)
|
||||||
|
|
||||||
|
if port != "0":
|
||||||
|
while True:
|
||||||
|
status = server.status()
|
||||||
|
query = server.query()
|
||||||
|
print("---------- " + ip + ":" + port + " ----------")
|
||||||
|
print(f"version: v{status.version.name} (protocol {status.version.protocol})")
|
||||||
|
print(f'description: "{status.description}"')
|
||||||
|
|
||||||
|
print(f"host: {query.raw['hostip']}:{query.raw['hostport']}")
|
||||||
|
print(f"software: v{query.software.version} {query.software.brand}")
|
||||||
|
print(f"plugins: {query.software.plugins}")
|
||||||
|
print(f"players: {status.players.online}/{status.players.max}")
|
||||||
|
print(f"Players Online: {query.players.names}")
|
||||||
|
print("\n")
|
||||||
|
wait(3)
|
Loading…
Add table
Add a link
Reference in a new issue