mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-17 21:40:31 +00:00
[-] Did not add async engine
This commit is contained in:
commit
3b6cd9e901
@ -204,5 +204,6 @@ def close_idle_server(user_id: Union[str, None], name: Union[str, None], port: i
|
||||
except Exception as e:
|
||||
print(e, user_id, name, server_stamp)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
@ -65,4 +65,4 @@ We're actively seeking maintainers that will triage issues and pull requests and
|
||||
If you work on a project that leverages Servii and have a vested interest in keeping the code alive and well, send an email to [charles@le-maux.dev], thank you for reading.
|
||||
|
||||
|
||||
[charles@le-maux.dev]: charles@le-maux.dev
|
||||
[charles@le-maux.dev]: mailto:charles@le-maux.dev
|
||||
|
@ -1,12 +1,13 @@
|
||||
import subprocess
|
||||
import shlex
|
||||
import subprocess
|
||||
import time
|
||||
import mcipc.query
|
||||
import mcipc.query.client
|
||||
from typing import Union
|
||||
|
||||
import mcipc.query
|
||||
import mcipc.query.client
|
||||
|
||||
import file_manager
|
||||
import firebase_manager
|
||||
import generic_executor
|
||||
|
||||
|
||||
class MinecraftServerManager:
|
||||
@ -87,10 +88,13 @@ class MinecraftServerManager:
|
||||
def get_online_players(self, port) -> int:
|
||||
if not self.servers[port]:
|
||||
return 0
|
||||
try:
|
||||
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
|
||||
stats: int = client.stats(full=False).num_players
|
||||
return stats
|
||||
except Exception as e:
|
||||
file_manager.log_error(type(e).__name__, str(e))
|
||||
return 0
|
||||
|
||||
def set_cooldown(self, user_id):
|
||||
expiry_timestamp = time.time() + 30
|
||||
|
Loading…
Reference in New Issue
Block a user