Use Chat::formatMessage in Players/*
This commit is contained in:
@ -165,11 +165,11 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
public function forcePlayerToTeam($adminLogin, $targetLogin, $teamId, $calledByAdmin = true) {
|
||||
if ($calledByAdmin) {
|
||||
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||
if (!$admin) {
|
||||
return false;
|
||||
}
|
||||
if (!$admin) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -183,52 +183,54 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
if (!$this->forcePlayerToPlay($adminLogin, $targetLogin, true, false, $calledByAdmin)) {
|
||||
return false;
|
||||
}
|
||||
} catch (FaultException $exception) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($exception, $admin);
|
||||
}
|
||||
} catch (FaultException $e) {
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$this->maniaControl->getClient()->forcePlayerTeam($target->login, $teamId);
|
||||
} catch (ServerOptionsException $exception) {
|
||||
} catch (ServerOptionsException $e) {
|
||||
$this->forcePlayerToPlay($adminLogin, $targetLogin);
|
||||
return false;
|
||||
} catch (UnknownPlayerException $exception) {
|
||||
} catch (UnknownPlayerException $e) {
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
return false;
|
||||
} catch (GameModeException $e) {
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
return false;
|
||||
}
|
||||
|
||||
$message = false;
|
||||
$teamName = '';
|
||||
if ($teamId === self::TEAM_BLUE) {
|
||||
$teamName = '$00fBlue';
|
||||
} elseif ($teamId === self::TEAM_RED) {
|
||||
$teamName = '$f00Red';
|
||||
}
|
||||
|
||||
if ($teamName) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($exception, $admin);
|
||||
}
|
||||
return false;
|
||||
} catch (GameModeException $exception) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($exception, $admin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$chatMessage = false;
|
||||
|
||||
if ($calledByAdmin) {
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
if ($teamId === self::TEAM_BLUE) {
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' forced ' . $target->getEscapedNickname() . ' into the Blue-Team!';
|
||||
} else if ($teamId === self::TEAM_RED) {
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' forced ' . $target->getEscapedNickname() . ' into the Red-Team!';
|
||||
}
|
||||
} else {
|
||||
if ($teamId === self::TEAM_BLUE) {
|
||||
$chatMessage = $target->getEscapedNickname() . ' got forced into the Blue-Team!';
|
||||
} else if ($teamId === self::TEAM_RED) {
|
||||
$chatMessage = $target->getEscapedNickname() . ' got forced into the Red-Team!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s forced %s into the %s-Team!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target,
|
||||
$teamName
|
||||
);
|
||||
} else {
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s got forced %s into the %s-Team!',
|
||||
$target,
|
||||
$teamName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$chatMessage) {
|
||||
return false;
|
||||
if ($message) {
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
}
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -260,24 +262,20 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
|
||||
try {
|
||||
$this->maniaControl->getClient()->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
||||
} catch (ServerOptionsException $exception) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($exception, $admin);
|
||||
}
|
||||
} catch (ServerOptionsException $e) {
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
return false;
|
||||
} catch (UnknownPlayerException $exception) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($exception, $admin);
|
||||
}
|
||||
} catch (UnknownPlayerException $e) {
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($userIsAbleToSelect) {
|
||||
try {
|
||||
$this->maniaControl->getClient()->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE);
|
||||
} catch (ServerOptionsException $exception) {
|
||||
} catch (ServerOptionsException $e) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($exception, $admin);
|
||||
$this->maniaControl->getChat()->sendException($e, $admin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -286,13 +284,20 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
// Announce force
|
||||
if ($displayAnnouncement) {
|
||||
if ($calledByAdmin) {
|
||||
$chatMessage = $admin->getEscapedNickname() . ' forced ' . $target->getEscapedNickname() . ' to Play!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s forced %s to Play!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
} else {
|
||||
$chatMessage = $target->getEscapedNickname() . ' got forced to Play!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s got forced to Play!',
|
||||
$target
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -312,12 +317,12 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
public function forcePlayerToSpectator($adminLogin, $targetLogin, $spectatorState = self::SPECTATOR_BUT_KEEP_SELECTABLE, $releaseSlot = true, $calledByAdmin = true) {
|
||||
if ($calledByAdmin) {
|
||||
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||
if (!$admin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$admin) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -330,21 +335,27 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
|
||||
try {
|
||||
$this->maniaControl->getClient()->forceSpectator($target->login, $spectatorState);
|
||||
} catch (ServerOptionsException $exception) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($exception, $admin->login);
|
||||
}
|
||||
} catch (ServerOptionsException $e) {
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($calledByAdmin) {
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' forced ' . $target->getEscapedNickname() . ' to Spectator!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s forced %s to Spectator!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
} else {
|
||||
$chatMessage = $target->getEscapedNickname() . ' got forced to Spectator!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s got forced to Spectator!',
|
||||
$target
|
||||
);
|
||||
}
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($message, true);
|
||||
|
||||
if ($releaseSlot) {
|
||||
// Free player slot
|
||||
@ -375,8 +386,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||
|
||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||
if (!$target) {
|
||||
return false;
|
||||
}
|
||||
@ -384,19 +395,30 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
try {
|
||||
$this->maniaControl->getClient()->unIgnore($targetLogin);
|
||||
} catch (NotInListException $e) {
|
||||
$this->maniaControl->getChat()->sendError('Player is not ignored!', $adminLogin);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s is not muted!',
|
||||
$player
|
||||
);
|
||||
$this->maniaControl->getChat()->sendError($message, $adminLogin);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($calledByAdmin) {
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' un-muted ' . $target->getEscapedNickname() . '!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s un-muted %s!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
} else {
|
||||
$chatMessage = $target->getEscapedNickname() . ' got un-muted!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s got un-muted!',
|
||||
$target
|
||||
);
|
||||
}
|
||||
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($message, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -418,8 +440,8 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||
|
||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||
if (!$target) {
|
||||
return false;
|
||||
}
|
||||
@ -427,20 +449,30 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
try {
|
||||
$this->maniaControl->getClient()->ignore($targetLogin);
|
||||
} catch (AlreadyInListException $e) {
|
||||
$this->maniaControl->getChat()->sendError("Player already ignored!", $adminLogin);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s is already muted!',
|
||||
$player
|
||||
);
|
||||
$this->maniaControl->getChat()->sendError($message, $adminLogin);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Announce warning
|
||||
if ($calledByAdmin) {
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' muted ' . $target->getEscapedNickname() . '!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s muted %s!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
} else {
|
||||
$chatMessage = $target->getEscapedNickname() . ' got muted!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s got muted!',
|
||||
$target
|
||||
);
|
||||
}
|
||||
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($message, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -464,7 +496,6 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
}
|
||||
|
||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||
|
||||
if (!$target) {
|
||||
return false;
|
||||
}
|
||||
@ -527,16 +558,22 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
// Display manialink
|
||||
$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $target);
|
||||
|
||||
// Announce warning
|
||||
if ($calledByAdmin) {
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' warned ' . $target->getEscapedNickname() . '!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s warned %s!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
} else {
|
||||
$chatMessage = $target->getEscapedNickname() . ' got an administrative warning!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s got warned!',
|
||||
$target
|
||||
);
|
||||
}
|
||||
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::log($chatMessage, true);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::log($message, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -570,37 +607,37 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
try {
|
||||
$this->maniaControl->getClient()->disconnectFakePlayer($target->login);
|
||||
} catch (PlayerStateException $e) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($e, $admin);
|
||||
}
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
return false;
|
||||
} catch (UnknownPlayerException $e) { //TODO check why it's actually needed, but there was a crash at this place
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($e, $admin);
|
||||
}
|
||||
} catch (UnknownPlayerException $e) {
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$this->maniaControl->getClient()->kick($target->login, $message);
|
||||
} catch (UnknownPlayerException $e) {
|
||||
if ($calledByAdmin) {
|
||||
$this->maniaControl->getChat()->sendException($e, $admin);
|
||||
}
|
||||
$this->maniaControl->getChat()->sendException($e, $adminLogin);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Announce kick
|
||||
if ($calledByAdmin) {
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' kicked ' . $target->getEscapedNickname() . '!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s kicked %s!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
} else {
|
||||
$chatMessage = $target->getEscapedNickname() . ' got kicked!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s got kicked!',
|
||||
$target
|
||||
);
|
||||
}
|
||||
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($message, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -639,12 +676,14 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Announce ban
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' banned ' . $target->getEscapedNickname() . '!';
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s banned %s!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($message, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -679,35 +718,52 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
return;
|
||||
}
|
||||
|
||||
// Announce ban
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' unbanned ' . $targetLogin . '!';
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'%s %s unbanned %s!',
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($message, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grands the Player an Authorization Level
|
||||
*
|
||||
* @api
|
||||
* @deprecated
|
||||
* @param string $adminLogin
|
||||
* @param string $targetLogin
|
||||
* @param int $authLevel
|
||||
*/
|
||||
public function grandAuthLevel($adminLogin, $targetLogin, $authLevel) {
|
||||
$this->grantAuthLevel($adminLogin, $targetLogin, $authLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants the Player an Authorization Level
|
||||
*
|
||||
* @api
|
||||
* @deprecated
|
||||
* @param string $adminLogin
|
||||
* @param string $targetLogin
|
||||
* @param int $authLevel
|
||||
*/
|
||||
public function grantAuthLevel($adminLogin, $targetLogin, $authLevel) {
|
||||
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||
if (!$admin || !$target) {
|
||||
return;
|
||||
}
|
||||
|
||||
$authLevelName = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($authLevel);
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkRight($admin, $authLevel + 1)) {
|
||||
$this->maniaControl->getChat()->sendError("You don't have the permission to add a {$authLevelName}!", $admin);
|
||||
$authLevelName = AuthenticationManager::getAuthLevelName($authLevel);
|
||||
if (!AuthenticationManager::checkRight($admin, $authLevel + 1)) {
|
||||
$this->maniaControl->getChat()->sendError("You do not have the permission to add a {$authLevelName}!", $admin);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->maniaControl->getAuthenticationManager()->checkRight($target, $authLevel)) {
|
||||
if (AuthenticationManager::checkRight($target, $authLevel)) {
|
||||
$this->maniaControl->getChat()->sendError("This Player is already {$authLevelName}!", $admin);
|
||||
return;
|
||||
}
|
||||
@ -718,11 +774,14 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
return;
|
||||
}
|
||||
|
||||
// Announce granting
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' added ' . $target->getEscapedNickname() . ' as $< ' . $authLevelName . '$>!';
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
"%s %s added %s as {$authLevelName}!",
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($message, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -739,14 +798,13 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkRight($admin, $target->authLevel + 1)) {
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($target->authLevel);
|
||||
$this->maniaControl->getChat()->sendError("You can't revoke the Rights of a {$title}!", $admin);
|
||||
if ($admin->authLevel <= $target->authLevel) {
|
||||
$this->maniaControl->getChat()->sendError("You cannot revoke the Rights of a {$target->getAuthLevelName()}!", $admin);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->maniaControl->getAuthenticationManager()->checkRight($target, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) {
|
||||
$this->maniaControl->getChat()->sendError("MasterAdmins can't be removed!", $admin);
|
||||
if (AuthenticationManager::checkRight($target, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) {
|
||||
$this->maniaControl->getChat()->sendError("MasterAdmins cannot be removed!", $admin);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -756,11 +814,13 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
|
||||
return;
|
||||
}
|
||||
|
||||
// Announce revoke
|
||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' revoked the Rights of ' . $target->getEscapedNickname() . '!';
|
||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||
Logger::logInfo($chatMessage, true);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
"%s %s revoked the Rights of %s!",
|
||||
$admin->getAuthLevelName(),
|
||||
$admin,
|
||||
$target
|
||||
);
|
||||
$this->maniaControl->getChat()->sendInformation($message);
|
||||
Logger::logInfo($message, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user