mirror of
https://github.com/onyx-and-iris/q3rcon-cli.git
synced 2026-04-12 20:13:38 +00:00
pre_run_hook added, it runs before all subcommands. gametype command now calls maprestart command directly if the -f flag is passed.
36 lines
905 B
Python
36 lines
905 B
Python
from collections import UserDict
|
|
|
|
|
|
class Config(UserDict):
|
|
DEFAULT_TIMEOUT: int = 2
|
|
DEFAULT_FRAGMENT_READ_TIMEOUT: float = 0.25
|
|
|
|
def __init__(self):
|
|
self.data = {
|
|
'status': (2, 0.25, False),
|
|
'fast_restart': (3, 1, True),
|
|
'map_restart': (3, 1, True),
|
|
'map': (3, 1, True),
|
|
'map_rotate': (3, 1, True),
|
|
}
|
|
|
|
def __getitem__(self, key):
|
|
return self.data.get(
|
|
key, (self.DEFAULT_TIMEOUT, self.DEFAULT_FRAGMENT_READ_TIMEOUT, False)
|
|
)
|
|
|
|
|
|
_config = Config()
|
|
|
|
|
|
def get(key: str):
|
|
match key:
|
|
case 'fast_restart' | 'fastrestart':
|
|
return _config['fast_restart']
|
|
case 'map_restart' | 'maprestart':
|
|
return _config['map_restart']
|
|
case 'map_rotate' | 'maprotate':
|
|
return _config['map_rotate']
|
|
case _:
|
|
return _config[key]
|