From 9a259d79133c815aa32c4f1d0734c8bb9f14fb76 Mon Sep 17 00:00:00 2001 From: Alexander Nell Date: Mon, 11 May 2020 17:19:35 +0200 Subject: [PATCH] Resolve Crash on //unban without login --- core/Players/PlayerActions.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/Players/PlayerActions.php b/core/Players/PlayerActions.php index f0038036..8a8ac27a 100644 --- a/core/Players/PlayerActions.php +++ b/core/Players/PlayerActions.php @@ -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) {