mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-12 12:55:21 +00:00
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:
commit
73a8c90bee
@ -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){
|
||||||
|
@ -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());
|
||||||
|
@ -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);
|
||||||
|
@ -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
|
||||||
|
@ -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{
|
||||||
|
@ -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{
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
@ -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{
|
||||||
|
|
||||||
|
@ -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{
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user