From fbdf92cd259523ba3e5545d71d1d6a0ac96be814 Mon Sep 17 00:00:00 2001 From: kremsy Date: Sun, 11 Jan 2015 16:00:55 +0100 Subject: [PATCH] exception unbann command --- core/Players/PlayerActions.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/core/Players/PlayerActions.php b/core/Players/PlayerActions.php index 98d5796e..754ec195 100644 --- a/core/Players/PlayerActions.php +++ b/core/Players/PlayerActions.php @@ -449,21 +449,17 @@ class PlayerActions { $this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); return; } - $target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); - if (!$target) { + + try { + $this->maniaControl->getClient()->unBan($targetLogin); + } catch (NotInListException $e) { + $this->maniaControl->getChat()->sendError('This player is not Banned!', $admin); return; } - if ($target->isFakePlayer()) { - $this->maniaControl->getChat()->sendError('It is not possible to Un-Ban a bot', $admin); - return; - } - - $this->maniaControl->getClient()->unBan($target->login); - // Announce ban $title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); - $chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' unbanned ' . $target->getEscapedNickname() . '!'; + $chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' unbanned ' . $targetLogin . '!'; $this->maniaControl->getChat()->sendInformation($chatMessage); Logger::logInfo($chatMessage, true); }