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