2019-02-15 01:49:34 +01:00
|
|
|
import random
|
|
|
|
|
2019-01-23 10:28:23 +01:00
|
|
|
class Greetings:
|
|
|
|
def __init__(self, server):
|
|
|
|
self.server = server
|
2019-02-15 01:49:34 +01:00
|
|
|
self.messages = ["Welcome %s!", "Beware! %s has arrived!", "A wild %s appears", "%s has come and is ready to pwn."]
|
2019-01-23 10:28:23 +01:00
|
|
|
|
2019-02-06 01:07:00 +01:00
|
|
|
async def on_player_join(self, player):
|
2019-02-15 01:49:34 +01:00
|
|
|
await self.server.broadcast_message(random.choice(self.messages) % player.name)
|
2019-01-23 10:28:23 +01:00
|
|
|
|
2019-02-06 01:07:00 +01:00
|
|
|
async def on_map_change(self, newmap):
|
|
|
|
await self.server.broadcast_message("You are now playing on "+newmap.mapname)
|
2019-01-23 10:28:23 +01:00
|
|
|
|
2019-02-19 01:01:31 +01:00
|
|
|
async def on_player_change_team(self, player, newteam):
|
|
|
|
await self.server.broadcast_message("%s switched to team %s" % (player.name, newteam))
|
|
|
|
|
2019-02-28 04:01:03 +01:00
|
|
|
async def on_player_left(self, player):
|
|
|
|
await self.server.broadcast_message("%s has left the game" % player.name)
|
|
|
|
|
2019-01-23 10:28:23 +01:00
|
|
|
|
|
|
|
def setup(server):
|
|
|
|
plugin = Greetings(server)
|
2019-02-19 01:01:31 +01:00
|
|
|
server.add_plugin(plugin)
|