mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-17 21:40:31 +00:00
[+] Minor fixes
This commit is contained in:
parent
34aa9217cd
commit
ef2aa65173
@ -65,7 +65,7 @@ class MinecraftServerManager:
|
|||||||
return server_id
|
return server_id
|
||||||
return None
|
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:
|
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
|
||||||
|
11
unit_test.py
11
unit_test.py
@ -1,4 +1,5 @@
|
|||||||
import firebase_manager
|
import firebase_manager
|
||||||
|
from mcipc.query import Client
|
||||||
|
|
||||||
|
|
||||||
def ban_user(user_id: str):
|
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__)
|
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__':
|
if __name__ == '__main__':
|
||||||
ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
|
#ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
|
||||||
|
get_online_players(25565)
|
||||||
|
Loading…
Reference in New Issue
Block a user