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:
|
except Exception as e:
|
||||||
print(e, user_id, name, server_stamp)
|
print(e, user_id, name, server_stamp)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pass
|
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.
|
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 shlex
|
||||||
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import mcipc.query
|
|
||||||
import mcipc.query.client
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import mcipc.query
|
||||||
|
import mcipc.query.client
|
||||||
|
|
||||||
|
import file_manager
|
||||||
import firebase_manager
|
import firebase_manager
|
||||||
import generic_executor
|
|
||||||
|
|
||||||
|
|
||||||
class MinecraftServerManager:
|
class MinecraftServerManager:
|
||||||
@ -87,10 +88,13 @@ class MinecraftServerManager:
|
|||||||
def get_online_players(self, port) -> int:
|
def get_online_players(self, port) -> int:
|
||||||
if not self.servers[port]:
|
if not self.servers[port]:
|
||||||
return 0
|
return 0
|
||||||
with mcipc.query.Client('127.0.0.1', port) as client:
|
try:
|
||||||
stats: mcipc.query.proto.FullStats = client.stats(full=True)
|
with mcipc.query.Client('127.0.0.1', port) as client:
|
||||||
stats: int = stats.num_players
|
stats: int = client.stats(full=False).num_players
|
||||||
return stats
|
return stats
|
||||||
|
except Exception as e:
|
||||||
|
file_manager.log_error(type(e).__name__, str(e))
|
||||||
|
return 0
|
||||||
|
|
||||||
def set_cooldown(self, user_id):
|
def set_cooldown(self, user_id):
|
||||||
expiry_timestamp = time.time() + 30
|
expiry_timestamp = time.time() + 30
|
||||||
|
Loading…
Reference in New Issue
Block a user