diff --git a/changelog.txt b/changelog.txt index b3d519c7..1f7a4850 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ #Additions - added changelog +- added "//removerights login" command - added new EchoManager which handles Interactions between different Controllers - It is possible to send an Echo command via the Method sendEcho, as message Parameter strings, objects or arrays can get used - An EchoListener can be added, callable by closure or implicit use (like on callbacks) @@ -10,8 +11,18 @@ - 4 Echos are Implemented by ManiaControl (ManiaControl.Restart, ManiaControl.AuthenticationManager.GrandLevel, ManiaControl.AuthenticationManager.RevokeLevel, ManiaControl.PlayerManager.WarnPlayer) - added Method getServerLoginByIndex to Server object - added some missing PHP Docs +- updated some depency libraries #Bug Fixes - fixed TriggerDebugNotice Method - Exception fix on kicking Players -- updated FaultException List \ No newline at end of file +- updated FaultException List + +###v0.157### +- labelline improvements + - new usage examples: + $positions = array($posX + 5, $posX + 18, $posX + 70); + $texts = array($index, $admin->nickname, $admin->login); + $this->maniaControl->getManialinkManager()->labelLine($playerFrame, array($positions, $texts)); +- improvements on Billmanager, added receiver to the BillData +- increased timeout time (fixes crashes on speedball) diff --git a/core/Admin/AuthCommands.php b/core/Admin/AuthCommands.php index 7b40b40c..15590e04 100644 --- a/core/Admin/AuthCommands.php +++ b/core/Admin/AuthCommands.php @@ -32,6 +32,8 @@ class AuthCommands implements CommandListener { $this->maniaControl->getCommandManager()->registerCommandListener('addsuperadmin', $this, 'command_AddSuperAdmin', true, 'Add Player to the AdminList as SuperAdmin.'); $this->maniaControl->getCommandManager()->registerCommandListener('addadmin', $this, 'command_AddAdmin', true, 'Add Player to the AdminList as Admin.'); $this->maniaControl->getCommandManager()->registerCommandListener('addmod', $this, 'command_AddModerator', true, 'Add Player to the AdminList as Moderator.'); + + $this->maniaControl->getCommandManager()->registerCommandListener('removerights', $this, 'command_RemoveRights', true, 'Remove Player from the AdminList.'); } /** @@ -159,4 +161,53 @@ class AuthCommands implements CommandListener { $message = "Usage Example: '//addmod login'"; return $this->maniaControl->getChat()->sendUsageInfo($message, $player); } + + + /** + * Handle //removerights command + * + * @param array $chatCallback + * @param Player $player + */ + public function command_RemoveRights(array $chatCallback, Player $player) { + if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { + $this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); + return; + } + $text = $chatCallback[1][2]; + $commandParts = explode(' ', $text); + if (!array_key_exists(1, $commandParts)) { + $this->sendRemoveRightsUsageInfo($player); + return; + } + $target = $this->maniaControl->getPlayerManager()->getPlayer($commandParts[1]); + if (!$target) { + $this->maniaControl->getChat()->sendError("Player '{$commandParts[1]}' not found!", $player); + return; + } + + if ($target->authLevel == AuthenticationManager::AUTH_LEVEL_MASTERADMIN) { + $this->maniaControl->getChat()->sendError("You can't remove an MasterAdmin from the Adminlists", $player); + return; + } + + $success = $this->maniaControl->getAuthenticationManager()->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_PLAYER); + if (!$success) { + $this->maniaControl->getChat()->sendError('Error occurred.', $player); + return; + } + $message = $player->getEscapedNickname() . ' removed ' . $target->getEscapedNickname() . ' from the Adminlists!'; + $this->maniaControl->getChat()->sendSuccess($message); + } + + /** + * Send usage example for //removerights command + * + * @param Player $player + * @return bool + */ + private function sendRemoveRightsUsageInfo(Player $player) { + $message = "Usage Example: '//addadmin login'"; + return $this->maniaControl->getChat()->sendUsageInfo($message, $player); + } }