AttorneyOnline / tsuserver3

An Attorney Online server.
GNU Affero General Public License v3.0
25 stars 51 forks source link

area_kick kinda works in a wrong way #174

Open Lernos opened 3 years ago

Lernos commented 3 years ago

Considering how it's made, area_kick basically checks if the area the client executing it from is locked, and if it is, then happily kicks the target from their current area to the target area, even if they were in another one. The client executing the command will, however, see an internal error message - that's because when attempting to execute if client.area.is_locked != client.area.Locked.FREE: client.area.invite_list.pop(c.id) the area tries to pop the target from the area invite list and they weren't in it in the first place. The way I see it, we should either let mods kick target from any area to any area, whether the mod's area is locked or not and whether they're in the same area with the target or not, or to restrict kicking to current area only. The former can be made possible by removing if client.area.is_locked == client.area.Locked.FREE: raise ClientError('Area isn\'t locked.') from the beginning of ooc_cmd_area_kick and possibly adding a check so as to not raise any errors: if client.area.is_locked != client.area.Locked.FREE and c.id in client.area.invite_list: client.area.invite_list.pop(c.id)