Merge branch 'minor-next' of github.com:pmmp/PocketMine-MP into feat/async-events

This commit is contained in:
Dylan K. Taylor
2024-11-13 14:46:32 +00:00
114 changed files with 3552 additions and 1040 deletions

View File

@@ -545,6 +545,11 @@ parameters:
count: 1
path: ../../../src/entity/projectile/Projectile.php
-
message: "#^Parameter \\#1 \\$promises of static method pocketmine\\\\promise\\\\Promise\\<mixed\\>\\:\\:all\\(\\) expects non\\-empty\\-array\\<int, pocketmine\\\\promise\\\\Promise\\<null\\>\\>, array\\<int, pocketmine\\\\promise\\\\Promise\\<null\\>\\> given\\.$#"
count: 1
path: ../../../src/event/AsyncEvent.php
-
message: "#^Parameter \\#2 \\$recipe of class pocketmine\\\\event\\\\inventory\\\\CraftItemEvent constructor expects pocketmine\\\\crafting\\\\CraftingRecipe, pocketmine\\\\crafting\\\\CraftingRecipe\\|null given\\.$#"
count: 1
@@ -785,11 +790,6 @@ parameters:
count: 1
path: ../../../src/resourcepacks/ZippedResourcePack.php
-
message: "#^Parameter \\#2 \\$length of function fread expects int\\<0, max\\>, int given\\.$#"
count: 1
path: ../../../src/resourcepacks/ZippedResourcePack.php
-
message: "#^Property pocketmine\\\\resourcepacks\\\\ZippedResourcePack\\:\\:\\$fileResource \\(resource\\) does not accept resource\\|false\\.$#"
count: 1
@@ -1035,11 +1035,6 @@ parameters:
count: 1
path: ../../../src/world/format/io/region/RegionLoader.php
-
message: "#^Parameter \\#2 \\$length of function fread expects int\\<0, max\\>, int given\\.$#"
count: 1
path: ../../../src/world/format/io/region/RegionLoader.php
-
message: "#^Parameter \\#2 \\$size of function ftruncate expects int\\<0, max\\>, int given\\.$#"
count: 1
@@ -1190,38 +1185,3 @@ parameters:
count: 1
path: ../../../src/world/light/SkyLightUpdate.php
-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 1
path: ../../phpunit/block/BlockTest.php
-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 1
path: ../../phpunit/block/regenerate_consistency_check.php
-
message: "#^Parameter \\#1 \\$logFile of class pocketmine\\\\utils\\\\MainLogger constructor expects string, string\\|false given\\.$#"
count: 1
path: ../../phpunit/scheduler/AsyncPoolTest.php
-
message: "#^Right side of && is always true\\.$#"
count: 1
path: ../../../src/promise/Promise.php
-
message: "#^Parameter \\#1 \\$value of method pocketmine\\\\promise\\\\PromiseResolver\\<null\\>\\:\\:resolve\\(\\) expects null, string given\\.$#"
count: 2
path: ../../../src/event/AsyncEventDelegate.php
-
message: "#^Parameter \\#1 \\$handler of class pocketmine\\\\event\\\\RegisteredAsyncListener constructor expects Closure\\(pocketmine\\\\event\\\\AsyncEvent&pocketmine\\\\event\\\\Event\\)\\: pocketmine\\\\promise\\\\Promise\\<null\\>, \\(Closure\\(TEvent\\)\\: void\\)\\|\\(Closure\\(pocketmine\\\\event\\\\AsyncEvent&TEvent\\)\\: pocketmine\\\\promise\\\\Promise\\<null\\>\\) given\\.$#"
count: 1
path: ../../../src/plugin/PluginManager.php
-
message: "#^Parameter \\#1 \\$handler of class pocketmine\\\\event\\\\RegisteredAsyncListener constructor expects Closure\\(pocketmine\\\\event\\\\AsyncEvent&pocketmine\\\\event\\\\Event\\)\\: pocketmine\\\\promise\\\\Promise\\<null\\>, Closure\\(TEvent\\)\\: pocketmine\\\\promise\\\\Promise\\<null\\> given\\.$#"
count: 1
path: ../../../src/plugin/PluginManager.php

View File

@@ -5,6 +5,16 @@ parameters:
count: 1
path: ../../../src/block/CakeWithCandle.php
-
message: "#^Method pocketmine\\\\block\\\\CopperDoor\\:\\:onInteractCopper\\(\\) has parameter \\$returnedItems with no value type specified in iterable type array\\.$#"
count: 1
path: ../../../src/block/CopperDoor.php
-
message: "#^Method pocketmine\\\\block\\\\CopperTrapdoor\\:\\:onInteractCopper\\(\\) has parameter \\$returnedItems with no value type specified in iterable type array\\.$#"
count: 1
path: ../../../src/block/CopperTrapdoor.php
-
message: "#^Method pocketmine\\\\block\\\\DoubleTallGrass\\:\\:traitGetDropsForIncompatibleTool\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1

View File

@@ -79,6 +79,7 @@
"CAKE_WITH_CANDLE": 2,
"CAKE_WITH_DYED_CANDLE": 32,
"CALCITE": 1,
"CAMPFIRE": 8,
"CANDLE": 8,
"CARPET": 16,
"CARROTS": 8,
@@ -104,6 +105,7 @@
"CHERRY_WOOD": 6,
"CHEST": 4,
"CHISELED_BOOKSHELF": 256,
"CHISELED_COPPER": 8,
"CHISELED_DEEPSLATE": 1,
"CHISELED_NETHER_BRICKS": 1,
"CHISELED_POLISHED_BLACKSTONE": 1,
@@ -111,6 +113,8 @@
"CHISELED_RED_SANDSTONE": 1,
"CHISELED_SANDSTONE": 1,
"CHISELED_STONE_BRICKS": 1,
"CHISELED_TUFF": 1,
"CHISELED_TUFF_BRICKS": 1,
"CHORUS_FLOWER": 6,
"CHORUS_PLANT": 1,
"CLAY": 1,
@@ -130,7 +134,11 @@
"CONCRETE": 16,
"CONCRETE_POWDER": 16,
"COPPER": 8,
"COPPER_BULB": 32,
"COPPER_DOOR": 256,
"COPPER_GRATE": 8,
"COPPER_ORE": 1,
"COPPER_TRAPDOOR": 128,
"CORAL": 10,
"CORAL_BLOCK": 10,
"CORAL_FAN": 20,
@@ -532,6 +540,10 @@
"POLISHED_GRANITE": 1,
"POLISHED_GRANITE_SLAB": 3,
"POLISHED_GRANITE_STAIRS": 8,
"POLISHED_TUFF": 1,
"POLISHED_TUFF_SLAB": 3,
"POLISHED_TUFF_STAIRS": 8,
"POLISHED_TUFF_WALL": 162,
"POPPY": 1,
"POTATOES": 8,
"POTION_CAULDRON": 6,
@@ -610,6 +622,7 @@
"SMOOTH_STONE_SLAB": 3,
"SNOW": 1,
"SNOW_LAYER": 8,
"SOUL_CAMPFIRE": 8,
"SOUL_FIRE": 1,
"SOUL_LANTERN": 2,
"SOUL_SAND": 1,
@@ -660,6 +673,13 @@
"TRIPWIRE": 16,
"TRIPWIRE_HOOK": 16,
"TUFF": 1,
"TUFF_BRICKS": 1,
"TUFF_BRICK_SLAB": 3,
"TUFF_BRICK_STAIRS": 8,
"TUFF_BRICK_WALL": 162,
"TUFF_SLAB": 3,
"TUFF_STAIRS": 8,
"TUFF_WALL": 162,
"TWISTING_VINES": 26,
"UNDERWATER_TORCH": 5,
"VINES": 16,

View File

@@ -24,8 +24,10 @@ declare(strict_types=1);
namespace pocketmine\data\bedrock\block\upgrade;
use PHPUnit\Framework\TestCase;
use pocketmine\block\Block;
use pocketmine\data\bedrock\block\BlockStateData;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use const PHP_INT_MAX;
class BlockStateUpgraderTest extends TestCase{
@@ -210,6 +212,23 @@ class BlockStateUpgraderTest extends TestCase{
self::assertSame($upgradedStateData->getState(self::TEST_PROPERTY_2)?->getValue(), $valueAfter);
}
public function testFlattenProperty() : void{
$schema = $this->getNewSchema();
$schema->flattenedProperties[self::TEST_BLOCK] = new BlockStateUpgradeSchemaFlattenInfo(
"minecraft:",
"test",
"_suffix",
[],
StringTag::class
);
$stateData = new BlockStateData(self::TEST_BLOCK, ["test" => new StringTag("value1")], 0);
$upgradedStateData = $this->upgrade($stateData, fn() => $stateData);
self::assertSame("minecraft:value1_suffix", $upgradedStateData->getName());
self::assertEmpty($upgradedStateData->getStates());
}
/**
* @phpstan-return \Generator<int, array{int, int, bool, int}, void, void>
*/

View File

@@ -7,6 +7,9 @@ while getopts "t:" OPTION 2> /dev/null; do
t)
PM_WORKERS="$OPTARG"
;;
\?)
break
;;
esac
done
@@ -19,7 +22,7 @@ rm PocketMine-MP.phar 2> /dev/null
mkdir "$DATA_DIR"
mkdir "$PLUGINS_DIR"
cd tests/plugins/DevTools
cd tests/plugins/DevTools || { echo "Couldn't change directory to $DIR"; exit 1; }
php -dphar.readonly=0 ./src/ConsoleScript.php --make ./ --relative ./ --out "$PLUGINS_DIR/DevTools.phar"
cd ../../..
composer make-server
@@ -45,7 +48,7 @@ if [ "$result" != "" ]; then
echo "$result"
echo Some tests did not complete successfully, changing build status to failed
exit 1
elif [ $(grep -c "ERROR\|CRITICAL\|EMERGENCY" "$DATA_DIR/server.log") -ne 0 ]; then
elif [ "$(grep -c "ERROR\|CRITICAL\|EMERGENCY" "$DATA_DIR/server.log")" -ne 0 ]; then
echo Server log contains error messages, changing build status to failed
exit 1
else