diff --git a/src/PocketMine/Player.php b/src/PocketMine/Player.php index ad96aac7f..dd7e31f50 100644 --- a/src/PocketMine/Player.php +++ b/src/PocketMine/Player.php @@ -2111,9 +2111,11 @@ class Player extends Human implements CommandSender{ */ public function close($message = "", $reason = "generic reason"){ if($this->connected === true){ + unset($this->level->players[$this->CID]); if($this->username != ""){ $this->server->getPluginManager()->callEvent($ev = new Event\Player\PlayerQuitEvent($this, $message)); if($this->loggedIn === true){ + parent::close(); $this->save(); } } @@ -2150,8 +2152,6 @@ class Player extends Human implements CommandSender{ $this->chunkCount = array(); $this->craftingItems = array(); $this->received = array(); - unset($this->level->players[$this->CID]); - parent::close(); $this->buffer = null; unset($this->buffer); } diff --git a/src/PocketMine/command/defaults/BanIpCommand.php b/src/PocketMine/command/defaults/BanIpCommand.php index 8849572db..f3c9e10c9 100644 --- a/src/PocketMine/command/defaults/BanIpCommand.php +++ b/src/PocketMine/command/defaults/BanIpCommand.php @@ -55,7 +55,7 @@ class BanIpCommand extends VanillaCommand{ if(preg_match("/^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$/", $value)){ $this->processIPBan($value, $sender, $reason); }else{ - if(($player = Player::get($name, true)) instanceof Player){ + if(($player = Player::get($value, true)) instanceof Player){ $this->processIPBan($player->getIP(), $sender, $reason); }else{ $sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage); @@ -64,8 +64,6 @@ class BanIpCommand extends VanillaCommand{ } } - Command::broadcastCommandMessage($sender, "Banned player " . $name); - return true; } diff --git a/src/PocketMine/command/defaults/PardonIpCommand.php b/src/PocketMine/command/defaults/PardonIpCommand.php index 8b52d5ce8..335f70f80 100644 --- a/src/PocketMine/command/defaults/PardonIpCommand.php +++ b/src/PocketMine/command/defaults/PardonIpCommand.php @@ -50,7 +50,7 @@ class PardonIpCommand extends VanillaCommand{ if(preg_match("/^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$/", $args[0])){ Server::getInstance()->getIPBans()->remove($args[0]); - Command::broadcastCommandMessage($sender, "Pardoned IP " . $name); + Command::broadcastCommandMessage($sender, "Pardoned IP " . $args[0]); }else{ $sender->sendMessage("Invalid IP"); } diff --git a/src/PocketMine/nbt/tag/Compound.php b/src/PocketMine/nbt/tag/Compound.php index 4f94fe964..8e32be03a 100644 --- a/src/PocketMine/nbt/tag/Compound.php +++ b/src/PocketMine/nbt/tag/Compound.php @@ -51,7 +51,7 @@ class Compound extends NamedTag implements \ArrayAccess{ public function offsetSet($offset, $value){ if($value instanceof Tag){ $this->{$offset} = $value; - }elseif($this->{$offset} instanceof Tag){ + }elseif(isset($this->{$offset}) and $this->{$offset} instanceof Tag){ $this->{$offset}->setValue($value); } }