From 57fd4b9b9dcf81fb2d607ef11495acf11906fe01 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 29 Aug 2018 16:13:11 +0200 Subject: [PATCH] Fixed jukebox not emptying on toggle, and mod actions on multiple IPIDs. --- server/area_manager.py | 4 +-- server/commands.py | 64 +++++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/server/area_manager.py b/server/area_manager.py index e1b7e55..ad36362 100644 --- a/server/area_manager.py +++ b/server/area_manager.py @@ -168,8 +168,8 @@ class AreaManager: self.current_music = '' return - if vote_picked.char_id != self.jukebox_prev_char_id or vote_picked.name != self.current_music or len(self.jukebox_votes) > 1: - self.jukebox_prev_char_id = vote_picked.char_id + if vote_picked.client.char_id != self.jukebox_prev_char_id or vote_picked.name != self.current_music or len(self.jukebox_votes) > 1: + self.jukebox_prev_char_id = vote_picked.client.char_id if vote_picked.showname == '': self.send_command('MC', vote_picked.name, vote_picked.client.char_id) else: diff --git a/server/commands.py b/server/commands.py index 4c79c29..f951ca6 100644 --- a/server/commands.py +++ b/server/commands.py @@ -329,9 +329,9 @@ def ooc_cmd_kick(client, arg): if not client.is_mod: raise ClientError('You must be authorized to do that.') if len(arg) == 0: - raise ArgumentError('You must specify a target. Use /kick .') + raise ArgumentError('You must specify a target. Use /kick ...') args = list(arg.split(' ')) - client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args))) + client.send_host_message('Attempting to kick {} IPIDs.'.format(len(args))) for raw_ipid in args: try: ipid = int(raw_ipid) @@ -350,7 +350,7 @@ def ooc_cmd_ban(client, arg): if not client.is_mod: raise ClientError('You must be authorized to do that.') if len(arg) == 0: - raise ArgumentError('You must specify a target. Use /ban .') + raise ArgumentError('You must specify a target. Use /ban ...') args = list(arg.split(' ')) client.send_host_message('Attempting to ban {} IPIDs.'.format(len(args))) for raw_ipid in args: @@ -375,7 +375,7 @@ def ooc_cmd_unban(client, arg): if not client.is_mod: raise ClientError('You must be authorized to do that.') if len(arg) == 0: - raise ArgumentError('You must specify a target. Use /unban .') + raise ArgumentError('You must specify a target. Use /unban ...') args = list(arg.split(' ')) client.send_host_message('Attempting to unban {} IPIDs.'.format(len(args))) for raw_ipid in args: @@ -403,21 +403,21 @@ def ooc_cmd_mute(client, arg): args = list(arg.split(' ')) client.send_host_message('Attempting to mute {} IPIDs.'.format(len(args))) for raw_ipid in args: - try: + if raw_ipid.isdigit(): ipid = int(raw_ipid) - except: - raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid)) - try: - clients = client.server.client_manager.get_targets(client, TargetType.IPID, int(ipid), False) - msg = 'Muted ' + str(ipid) + ' clients' - for c in clients: - c.is_muted = True - msg += ' ' + c.get_char_name() + ' [' + c.id + '],' - msg = msg[:-1] - msg += '.' - client.send_host_message('{}'.format(msg)) - except: - client.send_host_message("No targets found. Use /mute for mute.") + clients = client.server.client_manager.get_targets(client, TargetType.IPID, ipid, False) + if (clients): + msg = 'Muted ' + str(ipid) + ' clients' + for c in clients: + c.is_muted = True + msg += ' ' + c.get_char_name() + ' [' + str(c.id) + '],' + msg = msg[:-1] + msg += '.' + client.send_host_message('{}'.format(msg)) + else: + client.send_host_message("No targets found. Use /mute ... for mute.") + else: + client.send_host_message('{} does not look like a valid IPID.'.format(raw_ipid)) def ooc_cmd_unmute(client, arg): if not client.is_mod: @@ -427,21 +427,21 @@ def ooc_cmd_unmute(client, arg): args = list(arg.split(' ')) client.send_host_message('Attempting to unmute {} IPIDs.'.format(len(args))) for raw_ipid in args: - try: + if raw_ipid.isdigit(): ipid = int(raw_ipid) - except: - raise ClientError('{} does not look like a valid IPID.'.format(raw_ipid)) - try: - clients = client.server.client_manager.get_targets(client, TargetType.IPID, int(ipid), False) - msg = 'Unmuted ' + str(ipid) + ' clients' - for c in clients: - c.is_muted = True - msg += ' ' + c.get_char_name() + ' [' + c.id + '],' - msg = msg[:-1] - msg += '.' - client.send_host_message('{}'.format(msg)) - except: - client.send_host_message("No targets found. Use /unmute for unmute.") + clients = client.server.client_manager.get_targets(client, TargetType.IPID, ipid, False) + if (clients): + msg = 'Unmuted ' + str(ipid) + ' clients' + for c in clients: + c.is_muted = False + msg += ' ' + c.get_char_name() + ' [' + str(c.id) + '],' + msg = msg[:-1] + msg += '.' + client.send_host_message('{}'.format(msg)) + else: + client.send_host_message("No targets found. Use /unmute ... for unmute.") + else: + client.send_host_message('{} does not look like a valid IPID.'.format(raw_ipid)) def ooc_cmd_login(client, arg): if len(arg) == 0: