mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Added API method Item->equalsExact() and removed some boilerplate code
This commit is contained in:
@ -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++;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user