fixed small bug on authentification level changes + instant addition of the admin panel
This commit is contained in:
parent
5452b99749
commit
6e4cf32a16
@ -2,7 +2,6 @@
|
||||
|
||||
namespace ManiaControl\Players;
|
||||
|
||||
use FML\Controls\Control;
|
||||
use FML\Controls\Frame;
|
||||
use FML\Controls\Labels\Label_Text;
|
||||
use FML\Controls\Quad;
|
||||
@ -57,7 +56,9 @@ class PlayerActions {
|
||||
return;
|
||||
}
|
||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||
if (!$target) return;
|
||||
if(!$target) {
|
||||
return;
|
||||
}
|
||||
|
||||
$success = $this->maniaControl->client->query('ForceSpectator', $target->login, ($type != 1 ? 0 : 2));
|
||||
if(!$success) {
|
||||
@ -84,7 +85,8 @@ class PlayerActions {
|
||||
return;
|
||||
}
|
||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||
if (!$target) return;
|
||||
if(!$target)
|
||||
return;
|
||||
|
||||
if($target->isSpectator) {
|
||||
$success = $this->maniaControl->client->query('ForceSpectator', $target->login, self::SPECTATOR_PLAYER);
|
||||
@ -104,11 +106,11 @@ class PlayerActions {
|
||||
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
|
||||
if($teamId == self::TEAM_BLUE) {
|
||||
$chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> into the Blue-Team!';
|
||||
}
|
||||
else if ($teamId == self::TEAM_RED) {
|
||||
} else if($teamId == self::TEAM_RED) {
|
||||
$chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> into the Red-Team!';
|
||||
}
|
||||
if (!$chatMessage) return;
|
||||
if(!$chatMessage)
|
||||
return;
|
||||
$this->maniaControl->chat->sendInformation($chatMessage);
|
||||
$this->maniaControl->log($chatMessage, true);
|
||||
}
|
||||
@ -215,7 +217,8 @@ class PlayerActions {
|
||||
return;
|
||||
}
|
||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||
if (!$target) return;
|
||||
if(!$target)
|
||||
return;
|
||||
|
||||
// Display warning message
|
||||
$message = '$s$f00This is an administrative warning.{br}{br}$gWhatever you wrote or you have done is against {br} our server\'s policy.
|
||||
@ -293,12 +296,12 @@ class PlayerActions {
|
||||
return;
|
||||
}
|
||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||
if (!$target) return;
|
||||
if(!$target)
|
||||
return;
|
||||
|
||||
if($target->isFakePlayer()) {
|
||||
$success = $this->maniaControl->client->query('DisconnectFakePlayer', $target->login);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$success = $this->maniaControl->client->query('Kick', $target->login, $message);
|
||||
}
|
||||
if(!$success) {
|
||||
@ -327,7 +330,8 @@ class PlayerActions {
|
||||
return;
|
||||
}
|
||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||
if (!$target) return;
|
||||
if(!$target)
|
||||
return;
|
||||
|
||||
$success = $this->maniaControl->client->query('Ban', $target->login, $message);
|
||||
if(!$success) {
|
||||
@ -352,11 +356,13 @@ class PlayerActions {
|
||||
public function grandAuthLevel($adminLogin, $targetLogin, $authLevel) {
|
||||
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||
if (!$admin || !$target) return;
|
||||
if(!$admin || !$target)
|
||||
return;
|
||||
|
||||
$authLevelName = $this->maniaControl->authenticationManager->getAuthLevelName($authLevel);
|
||||
if ($this->maniaControl->authenticationManager->checkRight($admin, $authLevel + 1)) {
|
||||
if(!$this->maniaControl->authenticationManager->checkRight($admin, $authLevel + 1)) {
|
||||
$this->maniaControl->chat->sendError("You don't have the permission to add a {$authLevelName}!", $admin->login);
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->maniaControl->authenticationManager->checkRight($target, $authLevel)) {
|
||||
@ -386,9 +392,10 @@ class PlayerActions {
|
||||
public function revokeAuthLevel($adminLogin, $targetLogin) {
|
||||
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||
if (!$admin || !$target) return;
|
||||
if(!$admin || !$target)
|
||||
return;
|
||||
|
||||
if ($this->maniaControl->authenticationManager->checkRight($admin, $target->authLevel + 1)) {
|
||||
if(!$this->maniaControl->authenticationManager->checkRight($admin, $target->authLevel + 1)) {
|
||||
$title = $this->maniaControl->authenticationManager->getAuthLevelName($target->authLevel);
|
||||
$this->maniaControl->chat->sendError("You can't revoke the Rights of a {$title}!", $admin->login);
|
||||
return;
|
||||
@ -421,7 +428,8 @@ class PlayerActions {
|
||||
public function isPlayerMuted($login) {
|
||||
$this->maniaControl->client->query('GetIgnoreList', 100, 0);
|
||||
foreach($this->maniaControl->client->getResponse() as $ignoredPlayers) {
|
||||
if ($ignoredPlayers["Login"] == $login) return true;
|
||||
if($ignoredPlayers["Login"] == $login)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user