Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	resources/vanilla
#	src/world/Explosion.php
#	tests/phpunit/item/ItemTest.php
#	tests/phpunit/world/format/io/region/RegionLoaderTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
This commit is contained in:
Dylan K. Taylor 2020-11-01 14:21:47 +00:00
commit 73a8c90bee
10 changed files with 7 additions and 14 deletions

View File

@ -210,11 +210,11 @@ abstract class BaseInventory implements Inventory{
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){ for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
$slot = $this->getItem($i); $slot = $this->getItem($i);
if($item->equals($slot)){ if($item->equals($slot)){
if(($diff = $slot->getMaxStackSize() - $slot->getCount()) > 0){ if(($diff = min($slot->getMaxStackSize(), $item->getMaxStackSize()) - $slot->getCount()) > 0){
$count -= $diff; $count -= $diff;
} }
}elseif($slot->isNull()){ }elseif($slot->isNull()){
$count -= $this->getMaxStackSize(); $count -= min($this->getMaxStackSize(), $item->getMaxStackSize());
} }
if($count <= 0){ if($count <= 0){

View File

@ -157,7 +157,6 @@ class Explosion{
* and creating sounds and particles. * and creating sounds and particles.
*/ */
public function explodeB() : bool{ public function explodeB() : bool{
$send = [];
$updateBlocks = []; $updateBlocks = [];
$source = (new Vector3($this->source->x, $this->source->y, $this->source->z))->floor(); $source = (new Vector3($this->source->x, $this->source->y, $this->source->z))->floor();
@ -250,7 +249,6 @@ class Explosion{
$updateBlocks[$index] = true; $updateBlocks[$index] = true;
} }
} }
$send[] = $pos->subtractVector($source);
} }
$this->world->addParticle($source, new HugeExplodeSeedParticle()); $this->world->addParticle($source, new HugeExplodeSeedParticle());

View File

@ -116,8 +116,6 @@ class BlockTest extends TestCase{
/** /**
* @dataProvider blockGetProvider * @dataProvider blockGetProvider
* @param int $id
* @param int $meta
*/ */
public function testBlockGet(int $id, int $meta) : void{ public function testBlockGet(int $id, int $meta) : void{
$block = $this->blockFactory->get($id, $meta); $block = $this->blockFactory->get($id, $meta);

View File

@ -57,7 +57,6 @@ class StupidJsonDecodeTest extends TestCase{
/** /**
* @dataProvider stupidJsonDecodeProvider * @dataProvider stupidJsonDecodeProvider
* *
* @param string $brokenJson
* @param mixed $expect * @param mixed $expect
* *
* @throws \ReflectionException * @throws \ReflectionException

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\utils; namespace pocketmine\utils;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use function yaml_parse;
class ConfigTest extends TestCase{ class ConfigTest extends TestCase{
@ -61,7 +62,6 @@ class ConfigTest extends TestCase{
/** /**
* @dataProvider fixYamlIndexesProvider * @dataProvider fixYamlIndexesProvider
* *
* @param string $test
* @param mixed[] $expected * @param mixed[] $expected
*/ */
public function testFixYamlIndexes(string $test, array $expected) : void{ public function testFixYamlIndexes(string $test, array $expected) : void{

View File

@ -51,7 +51,6 @@ class UtilsTest extends TestCase{
} }
/** /**
* @param string $docComment
* @dataProvider parseDocCommentNewlineProvider * @dataProvider parseDocCommentNewlineProvider
*/ */
public function testParseDocCommentNewlines(string $docComment) : void{ public function testParseDocCommentNewlines(string $docComment) : void{

View File

@ -82,8 +82,6 @@ class RegionLoaderTest extends TestCase{
/** /**
* @dataProvider outOfBoundsCoordsProvider * @dataProvider outOfBoundsCoordsProvider
* @param int $x
* @param int $z
* *
* @throws ChunkException * @throws ChunkException
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
@ -110,9 +108,6 @@ class RegionLoaderTest extends TestCase{
/** /**
* @dataProvider outOfBoundsCoordsProvider * @dataProvider outOfBoundsCoordsProvider
* *
* @param int $x
* @param int $z
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \pocketmine\world\format\io\exception\CorruptedChunkException * @throws \pocketmine\world\format\io\exception\CorruptedChunkException
*/ */

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\world\format\io\region; namespace pocketmine\world\format\io\region;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use function sprintf;
class RegionLocationTableEntryTest extends TestCase{ class RegionLocationTableEntryTest extends TestCase{

View File

@ -26,6 +26,7 @@ namespace pmmp\TesterPlugin;
use pocketmine\event\Listener; use pocketmine\event\Listener;
use pocketmine\event\server\CommandEvent; use pocketmine\event\server\CommandEvent;
use pocketmine\plugin\PluginBase; use pocketmine\plugin\PluginBase;
use function array_shift;
class Main extends PluginBase implements Listener{ class Main extends PluginBase implements Listener{

View File

@ -23,6 +23,8 @@ declare(strict_types=1);
namespace pmmp\TesterPlugin; namespace pmmp\TesterPlugin;
use function time;
abstract class Test{ abstract class Test{
const RESULT_WAITING = -1; const RESULT_WAITING = -1;
const RESULT_OK = 0; const RESULT_OK = 0;