Merge remote-tracking branch 'origin/stable' into master

# Conflicts:
#	build/php
#	composer.lock
#	phpstan.neon.dist
#	resources/vanilla
#	src/pocketmine/Server.php
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/lang/locale
#	src/utils/Timezone.php
#	tests/phpstan/bootstrap.php
#	tests/phpstan/configs/custom-leveldb.neon
This commit is contained in:
Dylan K. Taylor 2020-10-13 17:51:49 +01:00
commit 44e446b621
11 changed files with 43 additions and 22 deletions

View File

@ -27,3 +27,8 @@ Plugin developers should **only** update their required API to this version if y
- Players no longer get pullbacks when sprinting on slabs, stairs and various other blocks when `player.anti-cheat.allow-movement-cheats` is set to `false`. (This bug has been around for over 5 years, so many of you will be used to its existence.) - Players no longer get pullbacks when sprinting on slabs, stairs and various other blocks when `player.anti-cheat.allow-movement-cheats` is set to `false`. (This bug has been around for over 5 years, so many of you will be used to its existence.)
- Fixed entity collision box calculation not taking clip distance into account. - Fixed entity collision box calculation not taking clip distance into account.
- Entities now step up the correct height of the target block, instead of jumping into the air 0.6 blocks and falling back down. - Entities now step up the correct height of the target block, instead of jumping into the air 0.6 blocks and falling back down.
# 3.15.2
- Fixed issues with preloading `SubChunk`.
- `/gc` and automatic garbage collection will now release unused heap blocks back to the OS. Previously, the PHP process might hold onto these blocks indefinitely even when not used, causing elevated real memory usage.
- Added some documentation to `FurnaceBurnEvent`.

View File

@ -2,7 +2,6 @@ includes:
- tests/phpstan/configs/actual-problems.neon - tests/phpstan/configs/actual-problems.neon
- tests/phpstan/configs/check-explicit-mixed-baseline.neon - tests/phpstan/configs/check-explicit-mixed-baseline.neon
- tests/phpstan/configs/com-dotnet-magic.neon - tests/phpstan/configs/com-dotnet-magic.neon
- tests/phpstan/configs/custom-leveldb.neon
- tests/phpstan/configs/ds-bugs.neon - tests/phpstan/configs/ds-bugs.neon
- tests/phpstan/configs/gc-hacks.neon - tests/phpstan/configs/gc-hacks.neon
- tests/phpstan/configs/l7-baseline.neon - tests/phpstan/configs/l7-baseline.neon

View File

@ -84,7 +84,7 @@ network:
#Set to 0 to compress everything, -1 to disable. #Set to 0 to compress everything, -1 to disable.
batch-threshold: 256 batch-threshold: 256
#Compression level used when sending batched packets. Higher = more CPU, less bandwidth usage #Compression level used when sending batched packets. Higher = more CPU, less bandwidth usage
compression-level: 7 compression-level: 6
#Use AsyncTasks for compression. Adds half/one tick delay, less CPU load on main thread #Use AsyncTasks for compression. Adds half/one tick delay, less CPU load on main thread
async-compression: false async-compression: false
#Experimental, only for Windows. Tries to use UPnP to automatically port forward #Experimental, only for Windows. Tries to use UPnP to automatically port forward

View File

@ -872,10 +872,10 @@ class Server{
$netCompressionThreshold = (int) $this->configGroup->getProperty("network.batch-threshold", 256); $netCompressionThreshold = (int) $this->configGroup->getProperty("network.batch-threshold", 256);
} }
$netCompressionLevel = (int) $this->configGroup->getProperty("network.compression-level", 7); $netCompressionLevel = (int) $this->configGroup->getProperty("network.compression-level", 6);
if($netCompressionLevel < 1 or $netCompressionLevel > 9){ if($netCompressionLevel < 1 or $netCompressionLevel > 9){
$this->logger->warning("Invalid network compression level $netCompressionLevel set, setting to default 7"); $this->logger->warning("Invalid network compression level $netCompressionLevel set, setting to default 6");
$netCompressionLevel = 7; $netCompressionLevel = 6;
} }
ZlibCompressor::setInstance(new ZlibCompressor($netCompressionLevel, $netCompressionThreshold, ZlibCompressor::DEFAULT_MAX_DECOMPRESSION_SIZE)); ZlibCompressor::setInstance(new ZlibCompressor($netCompressionLevel, $netCompressionThreshold, ZlibCompressor::DEFAULT_MAX_DECOMPRESSION_SIZE));

View File

@ -101,7 +101,6 @@ class StatusCommand extends VanillaCommand{
$sender->sendMessage(TextFormat::GOLD . "Total memory: " . TextFormat::RED . number_format(round(($mUsage[1] / 1024) / 1024, 2), 2) . " MB."); $sender->sendMessage(TextFormat::GOLD . "Total memory: " . TextFormat::RED . number_format(round(($mUsage[1] / 1024) / 1024, 2), 2) . " MB.");
$sender->sendMessage(TextFormat::GOLD . "Total virtual memory: " . TextFormat::RED . number_format(round(($mUsage[2] / 1024) / 1024, 2), 2) . " MB."); $sender->sendMessage(TextFormat::GOLD . "Total virtual memory: " . TextFormat::RED . number_format(round(($mUsage[2] / 1024) / 1024, 2), 2) . " MB.");
$sender->sendMessage(TextFormat::GOLD . "Heap memory: " . TextFormat::RED . number_format(round(($rUsage[0] / 1024) / 1024, 2), 2) . " MB."); $sender->sendMessage(TextFormat::GOLD . "Heap memory: " . TextFormat::RED . number_format(round(($rUsage[0] / 1024) / 1024, 2), 2) . " MB.");
$sender->sendMessage(TextFormat::GOLD . "Maximum memory (system): " . TextFormat::RED . number_format(round(($mUsage[2] / 1024) / 1024, 2), 2) . " MB.");
$globalLimit = $server->getMemoryManager()->getGlobalMemoryLimit(); $globalLimit = $server->getMemoryManager()->getGlobalMemoryLimit();
if($globalLimit > 0){ if($globalLimit > 0){

View File

@ -1020,8 +1020,14 @@ abstract class Entity{
$this->fall($this->fallDistance); $this->fall($this->fallDistance);
$this->resetFallDistance(); $this->resetFallDistance();
} }
}elseif($distanceThisTick < 0){ }elseif($distanceThisTick < $this->fallDistance){
//we've fallen some distance (distanceThisTick is negative)
//or we ascended back towards where fall distance was measured from initially (distanceThisTick is positive but less than existing fallDistance)
$this->fallDistance -= $distanceThisTick; $this->fallDistance -= $distanceThisTick;
}else{
//we ascended past the apex where fall distance was originally being measured from
//reset it so it will be measured starting from the new, higher position
$this->fallDistance = 0;
} }
} }

View File

@ -29,6 +29,9 @@ use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait; use pocketmine\event\CancellableTrait;
use pocketmine\item\Item; use pocketmine\item\Item;
/**
* Called when a furnace is about to consume a new fuel item.
*/
class FurnaceBurnEvent extends BlockEvent implements Cancellable{ class FurnaceBurnEvent extends BlockEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
@ -56,18 +59,31 @@ class FurnaceBurnEvent extends BlockEvent implements Cancellable{
return $this->fuel; return $this->fuel;
} }
/**
* Returns the number of ticks that the furnace will be powered for.
*/
public function getBurnTime() : int{ public function getBurnTime() : int{
return $this->burnTime; return $this->burnTime;
} }
/**
* Sets the number of ticks that the given fuel will power the furnace for.
*/
public function setBurnTime(int $burnTime) : void{ public function setBurnTime(int $burnTime) : void{
$this->burnTime = $burnTime; $this->burnTime = $burnTime;
} }
/**
* Returns whether the fuel item will be consumed.
*/
public function isBurning() : bool{ public function isBurning() : bool{
return $this->burning; return $this->burning;
} }
/**
* Sets whether the fuel will be consumed. If false, the furnace will smelt as if it consumed fuel, but no fuel
* will be deducted.
*/
public function setBurning(bool $burning) : void{ public function setBurning(bool $burning) : void{
$this->burning = $burning; $this->burning = $burning;
} }

View File

@ -56,7 +56,7 @@ class PluginDescription{
private $compatibleOperatingSystems = []; private $compatibleOperatingSystems = [];
/** /**
* @var string[][] * @var string[][]
* @phpstan-var array<string, list<mixed>> * @phpstan-var array<string, list<string>>
*/ */
private $extensions = []; private $extensions = [];
/** @var string[] */ /** @var string[] */
@ -130,7 +130,7 @@ class PluginDescription{
$k = $v; $k = $v;
$v = "*"; $v = "*";
} }
$this->extensions[$k] = is_array($v) ? $v : [$v]; $this->extensions[$k] = array_map('strval', is_array($v) ? $v : [$v]);
} }
} }

View File

@ -92,6 +92,7 @@ class SetupWizard{
$config->save(); $config->save();
if(strtolower($this->getInput($this->lang->get("skip_installer"), "n", "y/N")) === "y"){ if(strtolower($this->getInput($this->lang->get("skip_installer"), "n", "y/N")) === "y"){
$this->printIpDetails();
return true; return true;
} }
@ -101,6 +102,7 @@ class SetupWizard{
$this->generateUserFiles(); $this->generateUserFiles();
$this->networkFunctions(); $this->networkFunctions();
$this->printIpDetails();
$this->endWizard(); $this->endWizard();
@ -200,7 +202,9 @@ LICENSE;
} }
$config->save(); $config->save();
}
private function printIpDetails() : void{
$this->message($this->lang->get("ip_get")); $this->message($this->lang->get("ip_get"));
$externalIP = Internet::getIP(); $externalIP = Internet::getIP();

View File

@ -23,6 +23,10 @@ declare(strict_types=1);
define('pocketmine\_PHPSTAN_ANALYSIS', true); define('pocketmine\_PHPSTAN_ANALYSIS', true);
if(!defined('LEVELDB_ZLIB_RAW_COMPRESSION')){
//leveldb might not be loaded
define('LEVELDB_ZLIB_RAW_COMPRESSION', 4);
}
if(!extension_loaded('libdeflate')){ if(!extension_loaded('libdeflate')){
function libdeflate_deflate_compress(string $data, int $level = 6) : string{} function libdeflate_deflate_compress(string $data, int $level = 6) : string{}
} }

View File

@ -1,12 +0,0 @@
parameters:
ignoreErrors:
#TODO: use custom stubs
-
message: "#^Used constant LEVELDB_ZLIB_RAW_COMPRESSION not found\\.$#"
count: 1
path: ../../../src/world/format/io/leveldb/LevelDB.php
-
message: "#^Constant LEVELDB_ZLIB_RAW_COMPRESSION not found\\.$#"
count: 1
path: ../../../src/world/format/io/leveldb/LevelDB.php