mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Fixed not being able to wear armour
This commit is contained in:
parent
2cb81b5f8d
commit
e94db980d7
@ -461,4 +461,8 @@ abstract class BaseInventory implements Inventory{
|
||||
$player->dataPacket($pk);
|
||||
}
|
||||
}
|
||||
|
||||
public function slotExists(int $slot) : bool{
|
||||
return $slot >= 0 and $slot < $this->slots->getSize(); //use actual slots size to allow PlayerInventory to lie
|
||||
}
|
||||
}
|
||||
|
@ -231,4 +231,12 @@ interface Inventory{
|
||||
* @param bool $send
|
||||
*/
|
||||
public function onSlotChange(int $index, Item $before, bool $send) : void;
|
||||
|
||||
/**
|
||||
* Returns whether the specified slot exists in the inventory.
|
||||
*
|
||||
* @param int $slot
|
||||
* @return bool
|
||||
*/
|
||||
public function slotExists(int $slot) : bool;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class SlotChangeAction extends InventoryAction{
|
||||
public function isValid(Player $source) : bool{
|
||||
return (
|
||||
$this->inventorySlot >= 0 and
|
||||
$this->inventorySlot < $this->inventory->getSize() and
|
||||
$this->inventory->slotExists($this->inventorySlot) and
|
||||
$this->inventory->getItem($this->inventorySlot)->equalsExact($this->sourceItem)
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user