[+] Fixed non-static get_online_players

This commit is contained in:
Charles Le Maux 2024-08-20 20:07:39 +02:00
parent 6600b751ea
commit 1f8c6c22af

View File

@ -76,6 +76,8 @@ class MinecraftServerManager:
return None return None
def get_online_players(self, port) -> int: def get_online_players(self, port) -> int:
if not self.servers[port]:
return 0
with mcipc.query.Client('127.0.0.1', port) as client: with mcipc.query.Client('127.0.0.1', port) as client:
stats: mcipc.query.proto.FullStats = client.stats(full=True) stats: mcipc.query.proto.FullStats = client.stats(full=True)
stats: int = stats.num_players stats: int = stats.num_players