mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Server can be joined, again! (fixed weak references and blocks)
This commit is contained in:
@ -59,12 +59,6 @@ abstract class BaseInventory implements Inventory{
|
||||
$this->holder = $holder;
|
||||
$this->viewers = new \SplObjectStorage();
|
||||
|
||||
//A holder can be a plugin, or an entity
|
||||
if($this->holder instanceof Player){
|
||||
$this->holder->addWindow($this, 0);
|
||||
}
|
||||
|
||||
|
||||
$this->type = $type;
|
||||
if($overrideSize !== null){
|
||||
$this->size = (int) $overrideSize;
|
||||
@ -138,13 +132,12 @@ abstract class BaseInventory implements Inventory{
|
||||
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityInventoryChangeEvent($holder, $this->getItem($index), $item, $index));
|
||||
if($ev->isCancelled()){
|
||||
$this->sendContents($this->getViewers());
|
||||
|
||||
return false;
|
||||
}
|
||||
$item = $ev->getNewItem();
|
||||
}
|
||||
|
||||
$old = $this->slots[$index];
|
||||
$old = $this->getItem($index);
|
||||
$this->slots[$index] = clone $item;
|
||||
$this->onSlotChange($index, $old);
|
||||
|
||||
|
@ -211,16 +211,16 @@ class PlayerInventory extends BaseInventory{
|
||||
|
||||
if($index >= $this->getSize()){ //Armor change
|
||||
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityArmorChangeEvent($this->getHolder(), $this->getItem($index), $item, $index));
|
||||
if($ev->isCancelled()){
|
||||
$this->sendArmorContents($this);
|
||||
$this->sendContents($this);
|
||||
if($ev->isCancelled() and $this->getHolder() instanceof Player){
|
||||
$this->sendArmorContents($this->getHolder());
|
||||
$this->sendContents($this->getHolder());
|
||||
|
||||
return false;
|
||||
}
|
||||
$item = $ev->getNewItem();
|
||||
}
|
||||
|
||||
$old = $this->slots[$index];
|
||||
$old = $this->getItem($index);
|
||||
$this->slots[$index] = clone $item;
|
||||
$this->onSlotChange($index, $old);
|
||||
|
||||
|
Reference in New Issue
Block a user