Skip to content

Commit

Permalink
fix: wrong player admin level
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime1907 committed Feb 25, 2024
1 parent ad9de74 commit 16fb06d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.0
1.6.1
7 changes: 4 additions & 3 deletions src/torchlight/AccessManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ def Save(self) -> None:
json.dump(self.access_dict, fp, indent="\t")

def get_admin(self, *, unique_id: str) -> SourcemodAdmin | None:
admin: SourcemodAdmin | None = None
admin_copy: SourcemodAdmin | None = None
for admin in self.admins:
if admin.unique_id == unique_id:
return admin
return admin
admin_copy = copy.deepcopy(admin)
break
return admin_copy

def set_admin(self, unique_id: str, admin: SourcemodAdmin) -> None:
admin_copy = copy.deepcopy(admin)
Expand Down
6 changes: 4 additions & 2 deletions src/torchlight/Commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ async def _func(self, message: list[str], player: Player) -> int:
for targeted_player in self.player_manager.players:
if (
targeted_player
and targeted_player.name.lower().find(message[1].lower())
!= -1
and targeted_player.name.lower() == message[1].lower()
):
self.torchlight.SayChat(
FormatAccess(self.torchlight.config, targeted_player)
Expand Down Expand Up @@ -1140,6 +1139,9 @@ def ReloadValidUsers(self) -> None:
unique_id=player.unique_id
)
if admin_override is not None:
self.logger.info(
f"{player.unique_id}: overriding admin with {admin_override}"
)
player.admin = admin_override

async def _func(self, message: list[str], admin_player: Player) -> int:
Expand Down
6 changes: 6 additions & 0 deletions src/torchlight/PlayerManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def Event_PlayerConnect(
unique_id=player.unique_id
)
if admin_override is not None:
self.logger.info(
f"{player.unique_id}: overriding admin with {admin_override}"
)
player.admin = admin_override

for unique_id, audio_stored in self.audio_storage.items():
Expand Down Expand Up @@ -183,6 +186,9 @@ def Event_ServerSpawn(
unique_id=player.unique_id
)
if admin_override is not None:
self.logger.info(
f"{player.unique_id}: overriding admin with {admin_override}"
)
player.admin = admin_override
player.OnConnect()
self.audio_storage[player.unique_id] = player.storage
Expand Down
2 changes: 0 additions & 2 deletions src/torchlight/TriggerManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,3 @@ def Load(self) -> None:
self.logger.warn(
f"Sound path {sound_path} does not exist"
)

self.logger.info(f"Loaded {self.triggers_dict}")

0 comments on commit 16fb06d

Please sign in to comment.