diff --git a/DMBotNetwork/main/server.py b/DMBotNetwork/main/server.py index 33c9b35..d25541b 100644 --- a/DMBotNetwork/main/server.py +++ b/DMBotNetwork/main/server.py @@ -76,10 +76,10 @@ async def _call_func( try: if inspect.iscoroutinefunction(func): - return await func(**valid_kwargs) + return await func(cl_unit=cl_unit, **valid_kwargs) else: - return func(**valid_kwargs) + return func(cl_unit=cl_unit, **valid_kwargs) except Exception as e: logger.error(f"Error calling method '{func_name}' in {cls.__name__}: {e}") diff --git a/server_test.py b/server_test.py index a52c3fe..b234276 100644 --- a/server_test.py +++ b/server_test.py @@ -5,7 +5,8 @@ class NetClassPong: - async def net_ping(self, cl_unit: ClUnit) -> None: + @staticmethod + async def net_ping(cl_unit: ClUnit) -> None: await cl_unit.send_log_info(f"Pong, {cl_unit.login}!") @@ -19,7 +20,7 @@ async def main(): base_access={}, allow_registration=False, timeout=5.0, - max_player=0, + max_player=5, ) Server.register_methods_from_class(NetClassPong)