Merge remote-tracking branch 'origin/stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2022-05-11 13:12:45 +01:00
commit 9ff1bf6deb
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
10 changed files with 72 additions and 38 deletions

@ -1 +1 @@
Subproject commit 7b357f8cf9b2d2ee3a9ad247cdc76c8ad62337f9 Subproject commit 19222cfb2867869cfc9b96fbc5f6cdbd601f5e8b

View File

@ -19,3 +19,14 @@ Released 23rd April 2022.
## Fixes ## Fixes
- Updated BedrockProtocol dependency to fix incorrect command argument types. - Updated BedrockProtocol dependency to fix incorrect command argument types.
- Creative players no longer die in the void. - Creative players no longer die in the void.
# 4.3.2
Released 10th May 2022.
## Fixes
- Fixed an assertion failure in certain edge cases during world generation.
- Fixed `Entity::setNameTagVisible()` not immediately showing results to players already online.
## Documentation
- Added more documentation in the template `pocketmine.yml` for the `aliases` config section.
- Removed useless doc comment in `PlayerChangeSkinEvent`.

View File

@ -53,7 +53,7 @@
"webmozart/path-util": "^2.3" "webmozart/path-util": "^2.3"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "1.6.3", "phpstan/phpstan": "1.6.8",
"phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.2.0", "phpstan/phpstan-strict-rules": "^1.2.0",
"phpunit/phpunit": "^9.2" "phpunit/phpunit": "^9.2"

26
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c36ed8a47610c2fc26dfab18085c431c", "content-hash": "d6e210ffd1d4dbe1ed2c18f7c4abf385",
"packages": [ "packages": [
{ {
"name": "adhocore/json-comment", "name": "adhocore/json-comment",
@ -1819,16 +1819,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.6.3", "version": "1.6.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "6128620b98292e0b69ea6d799871d77163681c8e" "reference": "d76498c5531232cb8386ceb6004f7e013138d3ba"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/6128620b98292e0b69ea6d799871d77163681c8e", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d76498c5531232cb8386ceb6004f7e013138d3ba",
"reference": "6128620b98292e0b69ea6d799871d77163681c8e", "reference": "d76498c5531232cb8386ceb6004f7e013138d3ba",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1854,7 +1854,7 @@
"description": "PHPStan - PHP Static Analysis Tool", "description": "PHPStan - PHP Static Analysis Tool",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.6.3" "source": "https://github.com/phpstan/phpstan/tree/1.6.8"
}, },
"funding": [ "funding": [
{ {
@ -1874,7 +1874,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-04-28T11:27:53+00:00" "time": "2022-05-10T06:54:21+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",
@ -1930,16 +1930,16 @@
}, },
{ {
"name": "phpstan/phpstan-strict-rules", "name": "phpstan/phpstan-strict-rules",
"version": "1.2.1", "version": "1.2.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git", "url": "https://github.com/phpstan/phpstan-strict-rules.git",
"reference": "f3ca6464eae640a556c69a02b3b77a2507475d2f" "reference": "0c82c96f2a55d8b91bbc7ee6512c94f68a206b43"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/f3ca6464eae640a556c69a02b3b77a2507475d2f", "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/0c82c96f2a55d8b91bbc7ee6512c94f68a206b43",
"reference": "f3ca6464eae640a556c69a02b3b77a2507475d2f", "reference": "0c82c96f2a55d8b91bbc7ee6512c94f68a206b43",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1972,9 +1972,9 @@
"description": "Extra strict and opinionated rules for PHPStan", "description": "Extra strict and opinionated rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues", "issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.2.1" "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.2.3"
}, },
"time": "2022-04-28T07:20:18+00:00" "time": "2022-05-04T15:20:40+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",

View File

@ -195,6 +195,12 @@ aliases:
#kill: [suicide, say "I tried to kill $1"] ## `kill alex` -> `suicide` + `say "I tried to kill alex"` #kill: [suicide, say "I tried to kill $1"] ## `kill alex` -> `suicide` + `say "I tried to kill alex"`
#giverandom: [give $1 $2, say "Someone has just received a $2!"] ## `giverandom alex diamond` -> `give alex diamond` + `say "Someone has just received a diamond!"` #giverandom: [give $1 $2, say "Someone has just received a $2!"] ## `giverandom alex diamond` -> `give alex diamond` + `say "Someone has just received a diamond!"`
##To make arguments mandatory (so that the command fails if they are not provided), use $$, e.g. $$1, $$2:
#makeadmin: [op $$1] ## `makeadmin alex` -> `op alex`, `makeadmin` with no arguments = error
##To pass through a range of arguments, put a - (hyphen) after the index:
#tpalias: [tp $1-] ## `tpalias 256 70 256` -> `tp 256 70 256` - this passes arguments 1 and everything after it to the `tp` command
##To change an existing command alias and make it do something else: ##To change an existing command alias and make it do something else:
#tp: [suicide] #tp: [suicide]

View File

@ -282,6 +282,7 @@ abstract class Entity{
public function setNameTagVisible(bool $value = true) : void{ public function setNameTagVisible(bool $value = true) : void{
$this->nameTagVisible = $value; $this->nameTagVisible = $value;
$this->networkPropertiesDirty = true;
} }
public function setNameTagAlwaysVisible(bool $value = true) : void{ public function setNameTagAlwaysVisible(bool $value = true) : void{

View File

@ -42,5 +42,9 @@ class Boat extends Item{
return 1200; //400 in PC return 1200; //400 in PC
} }
public function getMaxStackSize() : int{
return 1;
}
//TODO //TODO
} }

View File

@ -59,6 +59,7 @@ use function interface_exists;
use function is_a; use function is_a;
use function is_array; use function is_array;
use function is_bool; use function is_bool;
use function is_float;
use function is_infinite; use function is_infinite;
use function is_int; use function is_int;
use function is_nan; use function is_nan;
@ -435,6 +436,19 @@ final class Utils{
return $lines; return $lines;
} }
private static function stringifyValueForTrace(mixed $value, int $maxStringLength) : string{
return match(true){
is_object($value) => "object " . self::getNiceClassName($value) . "#" . spl_object_id($value),
is_array($value) => "array[" . count($value) . "]",
is_string($value) => "string[" . strlen($value) . "] " . substr(Utils::printable($value), 0, $maxStringLength),
is_bool($value) => $value ? "true" : "false",
is_int($value) => "int " . $value,
is_float($value) => "float " . $value,
$value === null => "null",
default => gettype($value) . " " . Utils::printable((string) $value)
};
}
/** /**
* @param mixed[][] $trace * @param mixed[][] $trace
* @phpstan-param list<array<string, mixed>> $trace * @phpstan-param list<array<string, mixed>> $trace
@ -451,22 +465,15 @@ final class Utils{
}else{ }else{
$args = $trace[$i]["params"]; $args = $trace[$i]["params"];
} }
/** @var mixed[] $args */
$params = implode(", ", array_map(function($value) use($maxStringLength) : string{ $paramsList = [];
if(is_object($value)){ $offset = 0;
return "object " . self::getNiceClassName($value) . "#" . spl_object_id($value); foreach($args as $argId => $value){
} $paramsList[] = ($argId === $offset ? "" : "$argId: ") . self::stringifyValueForTrace($value, $maxStringLength);
if(is_array($value)){ $offset++;
return "array[" . count($value) . "]"; }
} $params = implode(", ", $paramsList);
if(is_string($value)){
return "string[" . strlen($value) . "] " . substr(Utils::printable($value), 0, $maxStringLength);
}
if(is_bool($value)){
return $value ? "true" : "false";
}
return gettype($value) . " " . Utils::printable((string) $value);
}, $args));
} }
$messages[] = "#$i " . (isset($trace[$i]["file"]) ? Filesystem::cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" || $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . Utils::printable($params) . ")"; $messages[] = "#$i " . (isset($trace[$i]["file"]) ? Filesystem::cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" || $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . Utils::printable($params) . ")";
} }

View File

@ -3004,9 +3004,14 @@ class World implements ChunkManager{
unset($this->activeChunkPopulationTasks[$index]); unset($this->activeChunkPopulationTasks[$index]);
if($dirtyChunks === 0){ if($dirtyChunks === 0){
$promise = $this->chunkPopulationRequestMap[$index]; $promise = $this->chunkPopulationRequestMap[$index] ?? null;
unset($this->chunkPopulationRequestMap[$index]); if($promise !== null){
$promise->resolve($chunk); unset($this->chunkPopulationRequestMap[$index]);
$promise->resolve($chunk);
}else{
//Handlers of ChunkPopulateEvent, ChunkLoadEvent, or just ChunkListeners can cause this
$this->logger->debug("Unable to resolve population promise for chunk x=$x,z=$z - populated chunk was forcibly unloaded while setting modified chunks");
}
}else{ }else{
//request failed, stick it back on the queue //request failed, stick it back on the queue
//we didn't resolve the promise or touch it in any way, so any fake chunk loaders are still valid and //we didn't resolve the promise or touch it in any way, so any fake chunk loaders are still valid and

View File

@ -40,6 +40,11 @@ parameters:
count: 1 count: 1
path: ../../../src/network/mcpe/handler/InGamePacketHandler.php path: ../../../src/network/mcpe/handler/InGamePacketHandler.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: ../../../src/network/mcpe/handler/InGamePacketHandler.php
- -
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\raklib\\\\PthreadsChannelWriter\\:\\:\\$buffer is never read, only written\\.$#" message: "#^Property pocketmine\\\\network\\\\mcpe\\\\raklib\\\\PthreadsChannelWriter\\:\\:\\$buffer is never read, only written\\.$#"
count: 1 count: 1
@ -85,8 +90,3 @@ parameters:
count: 2 count: 2
path: ../../../src/world/format/io/region/RegionLoader.php path: ../../../src/world/format/io/region/RegionLoader.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: ../../../src/network/mcpe/handler/InGamePacketHandler.php