Resolve Crash on //unban without login

This commit is contained in:
Alexander Nell 2020-05-11 17:19:35 +02:00
parent 7354ed278c
commit 9a259d7913
1 changed files with 12 additions and 1 deletions

View File

@ -628,7 +628,7 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
//Todo Validate (Problem: Not connected player isFakePlayer)
if ($target->isOfficial && $target->isFakePlayer()) {
$this->maniaControl->getChat()->sendError('It is not possible to Ban a bot', $admin);
$this->maniaControl->getChat()->sendError('It is not possible to Ban a bot!', $admin);
return;
}
@ -661,6 +661,17 @@ class PlayerActions implements EchoListener, CommunicationListener, UsageInforma
return;
}
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
if (!$target) {
return;
}
//Todo Validate (Problem: Not connected player isFakePlayer)
if ($target->isOfficial && $target->isFakePlayer()) {
$this->maniaControl->getChat()->sendError('It is not possible to unban a bot!', $admin);
return;
}
try {
$this->maniaControl->getClient()->unBan($targetLogin);
} catch (NotInListException $e) {