Fixed commands, NBT Player saving

This commit is contained in:
Shoghi Cervantes 2014-03-31 15:42:08 +02:00
parent 2f03251795
commit 00d777a68d
4 changed files with 5 additions and 7 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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");
}

View File

@ -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);
}
}