From 94759fd1c4ee016ab50c62b1828b7e5777de1425 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 24 Jan 2020 00:12:23 +0100 Subject: [PATCH] improve forfeitplayer --- MultiServer.py | 9 ++++----- README.md | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MultiServer.py b/MultiServer.py index 4d1f0504..f72fb6db 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -323,11 +323,10 @@ async def console(ctx : Context): slot = int(command[1]) forfeit_player(ctx, team, slot) if command[0] == '/forfeitplayer' and len(command) > 1: - team = int(command[2]) - 1 if len(command) > 2 and command[2].isdigit() else None - for client in ctx.clients: - if client.auth and client.name.lower() == command[1].lower() and (team is None or team == client.team): - if client.socket and not client.socket.closed: - forfeit_player(ctx, client.team, client.slot) + seeked_player = command[1].lower() + for (team, slot), name in ctx.player_names.items(): + if name.lower() == seeked_player: + forfeit_player(ctx, team, slot) if command[0] == '/senditem' and len(command) > 2: [(player, item)] = re.findall(r'\S* (\S*) (.*)', input) if item in Items.item_table: diff --git a/README.md b/README.md index 5ca3507d..265b00da 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Basis is a .yaml file that sets these weights. You can find an easy.yaml in this MultiServer.py * Added a try/except to prevent malformed console commands from crashing the entire server + * /forfeitplayer Playername now works when the player is not currently connected * Added /hint command on the server (use just /hint for help on command) can be used as /hint Playername Itemname All Itemnames can be found in Items.py starting at line 25