[-] Did not add async engine

This commit is contained in:
charleslemaux 2024-09-06 19:05:12 +02:00 committed by GitHub
commit 3b6cd9e901
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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