mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
Merge remote-tracking branch 'origin/stable'
# Conflicts: # resources/vanilla # src/pocketmine/VersionInfo.php
This commit is contained in:
commit
d08c9ee634
@ -49,3 +49,6 @@ Plugin developers should **only** update their required API to this version if y
|
|||||||
- `Maximum memory (system)` is no longer reported in `/status` due to having a misleading output (it was the same as the current memory usage).
|
- `Maximum memory (system)` is no longer reported in `/status` due to having a misleading output (it was the same as the current memory usage).
|
||||||
- The `Player Chunk Send` timer on timings reports now actually reports measurements of chunk sending, not chunk loading.
|
- The `Player Chunk Send` timer on timings reports now actually reports measurements of chunk sending, not chunk loading.
|
||||||
- A new parent timer `World Load` has been added to timings reports, which aggregates timings from `syncChunkLoad` and subtimings from all worlds.
|
- A new parent timer `World Load` has been added to timings reports, which aggregates timings from `syncChunkLoad` and subtimings from all worlds.
|
||||||
|
|
||||||
|
# 3.15.4
|
||||||
|
- Fixed a bug in the inventory transaction system that caused the server to freeze under some circumstances.
|
||||||
|
@ -233,21 +233,34 @@ class InventoryTransaction{
|
|||||||
protected function findResultItem(Item $needOrigin, array $possibleActions) : ?Item{
|
protected function findResultItem(Item $needOrigin, array $possibleActions) : ?Item{
|
||||||
assert(count($possibleActions) > 0);
|
assert(count($possibleActions) > 0);
|
||||||
|
|
||||||
|
$candidate = null;
|
||||||
|
$newList = $possibleActions;
|
||||||
foreach($possibleActions as $i => $action){
|
foreach($possibleActions as $i => $action){
|
||||||
if($action->getSourceItem()->equalsExact($needOrigin)){
|
if($action->getSourceItem()->equalsExact($needOrigin)){
|
||||||
$newList = $possibleActions;
|
if($candidate !== null){
|
||||||
|
/*
|
||||||
|
* we found multiple possible actions that match the origin action
|
||||||
|
* this means that there are multiple ways that this chain could play out
|
||||||
|
* if we cared so much about this, we could build all the possible chains in parallel and see which
|
||||||
|
* variation managed to complete the chain, but this has an extremely high complexity which is not
|
||||||
|
* worth the trouble for this scenario (we don't usually expect to see chains longer than a couple
|
||||||
|
* of actions in here anyway), and might still result in multiple possible results.
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$candidate = $action;
|
||||||
unset($newList[$i]);
|
unset($newList[$i]);
|
||||||
if(count($newList) === 0){
|
|
||||||
return $action->getTargetItem();
|
|
||||||
}
|
|
||||||
$result = $this->findResultItem($action->getTargetItem(), $newList);
|
|
||||||
if($result !== null){
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($candidate === null){
|
||||||
|
//chaining is not possible with this origin, none of the actions are valid
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
if(count($newList) === 0){
|
||||||
|
return $candidate->getTargetItem();
|
||||||
|
}
|
||||||
|
return $this->findResultItem($candidate->getTargetItem(), $newList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user