fix using the wrong method

This commit is contained in:
Beu 2023-12-15 11:14:23 +01:00
parent 740cde761a
commit 45e4417f97

View File

@ -127,7 +127,7 @@ class BlacklistManager implements CommandListener, Plugin {
if (!isset($login)) { if (!isset($login)) {
$this->maniaControl->getChat()->sendError( "Login not found. FYI The player must be connected" , $player); $this->maniaControl->getChat()->sendError( "Login not found. FYI The player must be connected" , $player);
} else { } else {
if ($this->addLoginToGL($login)) { if ($this->addLoginToBL($login)) {
$this->maniaControl->getChat()->sendSuccess( "Player " . $peopletoadd . " added to the Blacklist" , $player); $this->maniaControl->getChat()->sendSuccess( "Player " . $peopletoadd . " added to the Blacklist" , $player);
} else { } else {
$this->maniaControl->getChat()->sendSuccess( "Player " . $peopletoadd . " already in the Blacklist" , $player); $this->maniaControl->getChat()->sendSuccess( "Player " . $peopletoadd . " already in the Blacklist" , $player);
@ -142,14 +142,14 @@ class BlacklistManager implements CommandListener, Plugin {
* @param string $login * @param string $login
* @param array $blacklist * @param array $blacklist
*/ */
public function addLoginToGL(String $login, array $blacklist = []) { public function addLoginToBL(String $login, array $blacklist = []) {
if (empty($blacklist)) { if (empty($blacklist)) {
$blacklist = $this->maniaControl->getClient()->getBlackList(); $blacklist = $this->maniaControl->getClient()->getBlackList();
} }
$logintoadd = ""; $logintoadd = "";
$logintoadd = array_search($login ,array_column($blacklist, 'login')); $logintoadd = array_search($login ,array_column($blacklist, 'login'));
if (strlen($logintoadd) == 0) { if (strlen($logintoadd) == 0) {
$this->maniaControl->getClient()->addGuest($login); $this->maniaControl->getClient()->blackList($login);
return true; return true;
} else { } else {
return false; return false;