[+] Minor fixes

This commit is contained in:
Charles Le Maux 2024-08-11 11:02:10 +02:00
parent 34aa9217cd
commit ef2aa65173
2 changed files with 13 additions and 4 deletions

View File

@ -65,7 +65,7 @@ class MinecraftServerManager:
return server_id
return None
def get_online_players(self, port)->int:
def get_online_players(self, port) -> int:
with mcipc.query.Client('127.0.0.1', port) as client:
stats: mcipc.query.proto.FullStats = client.stats(full=True)
stats: int = stats.num_players

View File

@ -1,4 +1,5 @@
import firebase_manager
from mcipc.query import Client
def ban_user(user_id: str):
@ -9,5 +10,13 @@ def ban_user(user_id: str):
print("Error banning user "+user_id, "|", str(e), type(e).__name__)
def get_online_players(port) -> int:
with Client('127.0.0.1', port) as client:
stats: mcipc.query.proto.FullStats = client.stats(full=True)
stats: int = stats.num_players
return stats
if __name__ == '__main__':
ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
#ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
get_online_players(25565)