Fixed #2055 Extra packet data sent on armor change

This commit is contained in:
Shoghi Cervantes 2014-09-28 17:31:44 +02:00
parent 7b5869bea8
commit 886ad8442c
3 changed files with 9 additions and 4 deletions

View File

@ -1701,17 +1701,23 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$slot = $this->inventory->getArmorItem($i);
if($slot->getID() !== Item::AIR and $s->getID() === Item::AIR){
$this->inventory->setArmorItem($i, Item::get(Item::AIR, 0, 1));
$this->inventory->addItem($slot);
$this->inventory->sendArmorContents($this);
}elseif($s->getID() !== Item::AIR and $slot->getID() === Item::AIR and ($sl = $this->inventory->first($s)) !== -1){
if($this->inventory->setArmorItem($i, $this->inventory->getItem($sl)) === false){
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
}else{
$this->inventory->setItem($sl, Item::get(Item::AIR, 0, 1));
$this->inventory->setItem($sl, Item::get(Item::AIR, 0, 1), $this);
$this->inventory->sendArmorContents($this);
}
}elseif($s->getID() !== Item::AIR and $slot->getID() !== Item::AIR and ($slot->getID() !== $s->getID() or $slot->getDamage() !== $s->getDamage()) and ($sl = $this->inventory->first($s)) !== -1){
if($this->inventory->setArmorItem($i, $this->inventory->getItem($sl)) === false){
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
}else{
$this->inventory->setItem($sl, $slot);
$this->inventory->setItem($sl, $slot, $this);
$this->inventory->sendArmorContents($this);
}
}
}

View File

@ -1568,10 +1568,8 @@ class Server{
$this->enablePlugins(PluginLoadOrder::STARTUP);
if($this->getProperty("chunk-generation.use-async", true)){
$this->getLogger()->info("Started on thread");
$this->generationManager = new GenerationRequestManager($this);
}else{
$this->getLogger()->info("Started on main");
$this->generationManager = new GenerationInstanceManager($this);
}

View File

@ -211,6 +211,7 @@ class PlayerInventory extends BaseInventory{
}
$item = $ev->getNewItem();
}
if($item->getID() === 0){
$this->clear($index, $source);
}else{