Skip to content

Commit

Permalink
Update Client/profile_save.py
Browse files Browse the repository at this point in the history
Co-authored-by: Hauke Platte <[email protected]>
  • Loading branch information
bananabr3d and HOOK-Hawkins authored Mar 14, 2024
1 parent c7dd211 commit 7bd7e18
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions Client/profile_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,6 @@ def get_profile_by_name(self, player : Player):
print("json error: Make sure profiles.json is formatted correctly")
return None

def delete_profile(self, player : Player):
"""
This method deletes a profile by its uuid
:param profile_uuid:
"""
player_dict = player.as_dict()
if self.check_file():
try:
with open(self.path, 'r+') as file:
data = json.load(file)
for profile in data:
if profile["uuid"] == player_dict["uuid"]:
data.remove(profile)
break
else:
raise ValueError(f"Profile with given uuid: {player_dict['uuid']} not found")
with open(self.path, 'w') as file:
json.dump(data, file)
except:
raise RuntimeError("json error: Make sure profiles.json is formatted correctly")

def delete_profile_by_name(self, player : Player):
"""
This method deletes a profile by its name
Expand Down

0 comments on commit 7bd7e18

Please sign in to comment.