Disallow spaces in generated names

This commit is contained in:
Fabian Dill 2020-04-18 21:46:57 +02:00
parent ea53fff43e
commit 8599c76647
4 changed files with 4 additions and 5 deletions

View File

@ -204,7 +204,7 @@ def main(args, seed=None):
outfilepname += f'_P{player}' outfilepname += f'_P{player}'
if world.players > 1 or world.teams > 1: if world.players > 1 or world.teams > 1:
outfilepname += f"_{world.player_names[player][team].replace(' ', '_')}" if world.player_names[player][ outfilepname += f"_{world.player_names[player][team].replace(' ', '_')}" if world.player_names[player][
team] != 'Player %d' % player else '' team] != 'Player%d' % player else ''
outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s-%s%s%s%s%s' % (world.logic[player], world.difficulty[player], outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s-%s%s%s%s%s' % (world.logic[player], world.difficulty[player],
world.difficulty_adjustments[player], world.difficulty_adjustments[player],
world.mode[player], world.goal[player], world.mode[player], world.goal[player],

View File

@ -624,9 +624,8 @@ class ServerCommandProcessor(CommandProcessor):
def default(self, raw: str): def default(self, raw: str):
notify_all(self.ctx, '[Server]: ' + raw) notify_all(self.ctx, '[Server]: ' + raw)
def _cmd_kick(self, *player_name: str): def _cmd_kick(self, player_name: str):
"""Kick specified player from the server""" """Kick specified player from the server"""
player_name = " ".join(player_name)
for client in self.ctx.clients: for client in self.ctx.clients:
if client.auth and client.name.lower() == player_name.lower() and client.socket and not client.socket.closed: if client.auth and client.name.lower() == player_name.lower() and client.socket and not client.socket.closed:
asyncio.create_task(client.socket.close()) asyncio.create_task(client.socket.close())

View File

@ -24,7 +24,7 @@ def main(args):
# initialize the world # initialize the world
world = World(1, 'vanilla', 'noglitches', 'standard', 'normal', 'none', 'on', 'ganon', 'freshness', False, False, False, False, False, False, None, False) world = World(1, 'vanilla', 'noglitches', 'standard', 'normal', 'none', 'on', 'ganon', 'freshness', False, False, False, False, False, False, None, False)
world.player_names[1].append("Player 1") world.player_names[1].append("Player1")
logger = logging.getLogger('') logger = logging.getLogger('')
hasher = hashlib.md5() hasher = hashlib.md5()

View File

@ -35,7 +35,7 @@ def parse_player_names(names, players, teams):
team = [n[:16] for n in names[:players]] team = [n[:16] for n in names[:players]]
# where does the 16 character limit come from? # where does the 16 character limit come from?
while len(team) != players: while len(team) != players:
team.append(f"Player {len(team) + 1}") team.append(f"Player{len(team) + 1}")
ret.append(team) ret.append(team)
names = names[players:] names = names[players:]