fix stupid bug in PlayerInventory

This commit is contained in:
Dylan K. Taylor 2017-05-30 17:02:58 +01:00
parent 846e3b6f1e
commit 31e2c1d26c

View File

@ -112,9 +112,9 @@ class PlayerInventory extends BaseInventory{
*/ */
public function setHotbarSlotIndex($hotbarSlot, $inventorySlot){ public function setHotbarSlotIndex($hotbarSlot, $inventorySlot){
if($hotbarSlot < 0 or $hotbarSlot >= $this->getHotbarSize()){ if($hotbarSlot < 0 or $hotbarSlot >= $this->getHotbarSize()){
throw new \InvalidArgumentException("Hotbar slot index \"$index\" is out of range"); throw new \InvalidArgumentException("Hotbar slot index \"$hotbarSlot\" is out of range");
}elseif($inventorySlot < -1 or $inventorySlot >= $this->getSize()){ }elseif($inventorySlot < -1 or $inventorySlot >= $this->getSize()){
throw new \InvalidArgumentException("Inventory slot index \"$index\" is out of range"); throw new \InvalidArgumentException("Inventory slot index \"$inventorySlot\" is out of range");
} }
if($inventorySlot !== -1 and ($alreadyEquippedIndex = array_search($inventorySlot, $this->hotbar)) !== false){ if($inventorySlot !== -1 and ($alreadyEquippedIndex = array_search($inventorySlot, $this->hotbar)) !== false){