Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: ipad54 <[email protected]>
  • Loading branch information
ShockedPlot7560 and ipad54 committed Apr 4, 2024
1 parent 2d8449e commit 1d924c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/inventory/ArmorInventory.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function setBoots(Item $boots) : void{
$this->setItem(self::SLOT_FEET, $boots);
}

private function validate(Inventory $inventory, Item $item, int $slot) : null|TransactionValidationException{
private function validate(Inventory $inventory, Item $item, int $slot) : ?TransactionValidationException{
if($item instanceof Armor && $item->getArmorSlot() === $slot){
if($item->getArmorSlot() !== $slot){
return new TransactionValidationException("Armor item in wrong slot");
Expand Down
2 changes: 1 addition & 1 deletion src/inventory/transaction/action/SlotChangeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function validate(Player $source) : void{
if($this->inventory instanceof SlotSafeInventory && !$this->targetItem->isNull()){
foreach($this->inventory->getSlotValidators() as $validator){
$ret = $validator->validate($this->inventory, $this->targetItem, $this->inventorySlot);
if($ret instanceof TransactionValidationException){
if($ret !== null){
throw new TransactionValidationException("Target item is not accepted by the inventory slot: " . $ret->getMessage(), 0, $ret);
}
}
Expand Down

0 comments on commit 1d924c3

Please sign in to comment.