Added API method Item->equalsExact() and removed some boilerplate code

This commit is contained in:
Dylan K. Taylor
2017-09-15 16:48:46 +01:00
parent 0e51820dfb
commit bd64172750
4 changed files with 14 additions and 4 deletions

View File

@ -189,7 +189,7 @@ class SimpleInventoryTransaction implements InventoryTransaction{
$sortedThisLoop = 0;
foreach($list as $i => $action){
$actionSource = $action->getSourceItem();
if($actionSource->equals($lastTargetItem) and $actionSource->getCount() === $lastTargetItem->getCount()){
if($actionSource->equalsExact($lastTargetItem)){
$lastTargetItem = $action->getTargetItem();
unset($list[$i]);
$sortedThisLoop++;

View File

@ -75,7 +75,7 @@ class SlotChangeAction extends InventoryAction{
*/
public function isValid(Player $source) : bool{
$check = $this->inventory->getItem($this->inventorySlot);
return $check->equals($this->sourceItem) and $check->getCount() === $this->sourceItem->getCount();
return $check->equalsExact($this->sourceItem);
}
/**