/** * When a player leaves a team, remove them from every conversation that * includes that team * * @param TeamAbandonEvent|TeamKickEvent $event The event */ public function onTeamLeave(Event $event) { // We don't need to check which conversations include the player; a // player_conversations entry will have `distinct` set to 0 only if the // player belongs to a conversation because they are a member of this // team \Database::getInstance()->query("DELETE FROM `player_conversations`\n WHERE player = ?\n AND `distinct` = 0", "i", array($event->getPlayer()->getId())); }
/** * Get the available actions for the notification * * @return array */ public function getActions($email = false) { switch ($this->type) { case Events::TEAM_INVITE: return array($email ? 'Accept invitation' : 'Accept' => $this->event->getInvitation()->getUrl('accept', $email)); default: return array(); } }
/** * Called when an event needs to notify a user * * @param Event $event The event * @param string $name The name of the event */ public function notify(Event $event, $name) { $event->notify($name); }