mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
Update pdata.py
This commit is contained in:
parent
48751b952e
commit
eb94b72bcf
1 changed files with 8 additions and 3 deletions
11
dist/ba_root/mods/playersData/pdata.py
vendored
11
dist/ba_root/mods/playersData/pdata.py
vendored
|
|
@ -66,17 +66,22 @@ def get_profiles() -> dict:
|
|||
"""
|
||||
if CacheData.profiles=={}:
|
||||
try:
|
||||
if os.stat(PLAYERS_DATA_PATH+"profiles.json").st_size > 1000:
|
||||
if os.stat(PLAYERS_DATA_PATH+"profiles.json").st_size > 1000000:
|
||||
shutil.copyfile(PLAYERS_DATA_PATH + "profiles.json",PLAYERS_DATA_PATH + "profiles.json"+str(datetime.datetime.now()))
|
||||
profiles = {"pb-sdf":{}}
|
||||
print("resetting profiles")
|
||||
else:
|
||||
f=open(PLAYERS_DATA_PATH + "profiles.json","r")
|
||||
profiles = json.load(f)
|
||||
f.close()
|
||||
print("loading old proiles.json")
|
||||
CacheData.profiles=profiles
|
||||
f.close()
|
||||
except:
|
||||
|
||||
except Exception as e:
|
||||
f=open(PLAYERS_DATA_PATH + "profiles.json.backup","r")
|
||||
profiles = json.load(f)
|
||||
print(e)
|
||||
print("exception happened , falling back to profiles.json.backup")
|
||||
CacheData.profiles=profiles
|
||||
f.close()
|
||||
return profiles
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue