mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-11-07 17:36:15 +00:00
Merge branch 'public-server' of https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server into api8
This commit is contained in:
commit
cc7c7450d2
12 changed files with 354 additions and 24 deletions
7
dist/ba_root/mods/setting.py
vendored
7
dist/ba_root/mods/setting.py
vendored
|
|
@ -48,15 +48,18 @@ def commit(data: dict) -> None:
|
|||
if is_invalid_time_format(data['autoNightMode']['startTime']) or is_invalid_time_format(data['autoNightMode']['endTime']):
|
||||
data['autoNightMode']['startTime'] = "18:30"
|
||||
data['autoNightMode']['endTime'] = "6:30"
|
||||
print("Invalid time setting , resetting night mode time")
|
||||
|
||||
print("Invalid time setting , resetting night mode time")
|
||||
|
||||
with open(SETTINGS_PATH, mode="w", encoding="utf-8") as setting_file:
|
||||
json.dump(data, setting_file, indent=4)
|
||||
# settings updated ok now update the cache
|
||||
refresh_cache()
|
||||
|
||||
|
||||
def is_invalid_time_format(time_string, time_format='%H:%M'):
|
||||
try:
|
||||
datetime.datetime.strptime(time_string, time_format)
|
||||
return False
|
||||
except ValueError:
|
||||
return True
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue