BanIpCommand: fix crash when banning by playername, closes #2578

This commit is contained in:
Dylan K. Taylor 2018-12-15 13:59:10 +00:00
parent c5262fdf61
commit 19edacbea9

View File

@ -58,9 +58,10 @@ class BanIpCommand extends VanillaCommand{
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.banip.success", [$value]));
}else{
if(($player = $sender->getServer()->getPlayer($value)) instanceof Player){
$this->processIPBan($player->getAddress(), $sender, $reason);
$ip = $player->getAddress();
$this->processIPBan($ip, $sender, $reason);
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.banip.success.players", [$player->getAddress(), $player->getName()]));
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.banip.success.players", [$ip, $player->getName()]));
}else{
$sender->sendMessage(new TranslationContainer("commands.banip.invalid"));