import random class Greetings: def __init__(self, server): self.server = server self.messages = ["Welcome %s!", "Beware! %s has arrived!", "A wild %s appears", "%s has come and is ready to pwn."] async def on_player_join(self, player): await self.server.broadcast_message(random.choice(self.messages) % player.name) async def on_map_change(self, newmap): await self.server.broadcast_message("You are now playing on "+newmap.mapname) async def on_player_change_team(self, player, newteam): await self.server.broadcast_message("%s switched to team %s" % (player.name, newteam)) def setup(server): plugin = Greetings(server) server.add_plugin(plugin)