add callbacks for PlayerActions
This commit is contained in:
parent
4b9ea37217
commit
afe617b642
@ -47,6 +47,17 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
const SPECTATOR_BUT_KEEP_SELECTABLE = 3;
|
const SPECTATOR_BUT_KEEP_SELECTABLE = 3;
|
||||||
const ECHO_WARN_PLAYER = 'ManiaControl.PlayerManager.WarnPlayer';
|
const ECHO_WARN_PLAYER = 'ManiaControl.PlayerManager.WarnPlayer';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Callback Constants
|
||||||
|
*/
|
||||||
|
const CB_PLAYER_FORCED_TO_PLAY = 'PlayerActions.PlayerForcedToPlay';
|
||||||
|
const CB_PLAYER_FORCED_TO_TEAM = 'PlayerActions.PlayerForcedToTeam';
|
||||||
|
const CB_PLAYER_FORCED_TO_SPEC = 'PlayerActions.PlayerForcedToSpec';
|
||||||
|
const CB_PLAYER_MUTED = 'PlayerActions.PlayerMuted';
|
||||||
|
const CB_PLAYER_WARNED = 'PlayerActions.PlayerWarned';
|
||||||
|
const CB_PLAYER_KICKED = 'PlayerActions.PlayerKicked';
|
||||||
|
const CB_PLAYER_BANNED = 'PlayerActions.PlayerBanned';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Permission Setting Constants
|
* Permission Setting Constants
|
||||||
*/
|
*/
|
||||||
@ -201,6 +212,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYER_FORCED_TO_TEAM, $target, $teamId);
|
||||||
|
|
||||||
$message = false;
|
$message = false;
|
||||||
$teamName = '';
|
$teamName = '';
|
||||||
if ($teamId === self::TEAM_BLUE) {
|
if ($teamId === self::TEAM_BLUE) {
|
||||||
@ -229,7 +242,7 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
|
|
||||||
if ($message) {
|
if ($message) {
|
||||||
$this->maniaControl->getChat()->sendInformation($message);
|
$this->maniaControl->getChat()->sendInformation($message);
|
||||||
Logger::logInfo($chatMessage, true);
|
Logger::logInfo($message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -281,6 +294,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYER_FORCED_TO_PLAY, $target);
|
||||||
|
|
||||||
// Announce force
|
// Announce force
|
||||||
if ($displayAnnouncement) {
|
if ($displayAnnouncement) {
|
||||||
if ($calledByAdmin) {
|
if ($calledByAdmin) {
|
||||||
@ -340,6 +355,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYER_FORCED_TO_SPEC, $target);
|
||||||
|
|
||||||
if ($calledByAdmin) {
|
if ($calledByAdmin) {
|
||||||
$title = $admin->getAuthLevelName();
|
$title = $admin->getAuthLevelName();
|
||||||
$message = $this->maniaControl->getChat()->formatMessage(
|
$message = $this->maniaControl->getChat()->formatMessage(
|
||||||
@ -460,6 +477,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYER_MUTED, $target);
|
||||||
|
|
||||||
if ($calledByAdmin) {
|
if ($calledByAdmin) {
|
||||||
$title = $admin->getAuthLevelName();
|
$title = $admin->getAuthLevelName();
|
||||||
$message = $this->maniaControl->getChat()->formatMessage(
|
$message = $this->maniaControl->getChat()->formatMessage(
|
||||||
@ -561,6 +580,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
// Display manialink
|
// Display manialink
|
||||||
$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $target);
|
$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $target);
|
||||||
|
|
||||||
|
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYER_WARNED, $target);
|
||||||
|
|
||||||
if ($calledByAdmin) {
|
if ($calledByAdmin) {
|
||||||
$title = $admin->getAuthLevelName();
|
$title = $admin->getAuthLevelName();
|
||||||
$message = $this->maniaControl->getChat()->formatMessage(
|
$message = $this->maniaControl->getChat()->formatMessage(
|
||||||
@ -625,6 +646,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYER_KICKED, $target);
|
||||||
|
|
||||||
if ($calledByAdmin) {
|
if ($calledByAdmin) {
|
||||||
$title = $admin->getAuthLevelName();
|
$title = $admin->getAuthLevelName();
|
||||||
$message = $this->maniaControl->getChat()->formatMessage(
|
$message = $this->maniaControl->getChat()->formatMessage(
|
||||||
@ -679,6 +702,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYER_BANNED, $target);
|
||||||
|
|
||||||
$title = $admin->getAuthLevelName();
|
$title = $admin->getAuthLevelName();
|
||||||
$message = $this->maniaControl->getChat()->formatMessage(
|
$message = $this->maniaControl->getChat()->formatMessage(
|
||||||
"{$title} %s banned %s!",
|
"{$title} %s banned %s!",
|
||||||
|
Loading…
Reference in New Issue
Block a user