mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 07:54:19 +00:00
InventoryAction: avoid throwaway Item clones
This commit is contained in:
parent
2670e81668
commit
246c1776df
@ -144,8 +144,9 @@ class InventoryTransaction{
|
||||
$needItems = [];
|
||||
$haveItems = [];
|
||||
foreach($this->actions as $key => $action){
|
||||
if(!$action->getTargetItem()->isNull()){
|
||||
$needItems[] = $action->getTargetItem();
|
||||
$targetItem = $action->getTargetItem();
|
||||
if(!$targetItem->isNull()){
|
||||
$needItems[] = $targetItem;
|
||||
}
|
||||
|
||||
try{
|
||||
@ -154,8 +155,9 @@ class InventoryTransaction{
|
||||
throw new TransactionValidationException(get_class($action) . "#" . spl_object_id($action) . ": " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
if(!$action->getSourceItem()->isNull()){
|
||||
$haveItems[] = $action->getSourceItem();
|
||||
$sourceItem = $action->getSourceItem();
|
||||
if(!$sourceItem->isNull()){
|
||||
$haveItems[] = $sourceItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user