Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/CrashDump.php
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/network/mcpe/protocol/DataPacket.php
This commit is contained in:
Dylan K. Taylor 2020-12-23 22:34:25 +00:00
commit f215207a27
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
4 changed files with 22 additions and 14 deletions

View File

@ -15,3 +15,9 @@ Plugin developers should **only** update their required API to this version if y
- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon
- New blocks, items & mobs aren't implemented
- Nether doesn't exist
# 3.17.1
- Fixed some instances of plugin-caused crashes not being detected (eval()'d code, custom plugin paths).
- Server uptime is now included in crash reports.
- Hoes now take damage when used to break sponges.
- Using lava as fuel in a furnace now leaves behind an empty bucket.

View File

@ -50,7 +50,7 @@
"composer-runtime-api": "^2.0"
},
"require-dev": {
"phpstan/phpstan": "0.12.63",
"phpstan/phpstan": "0.12.64",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^9.2"

14
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "9ffd33446ed14804ca22c92c04a39796",
"content-hash": "ac798f92ac7eb3abe7fcead8074bac94",
"packages": [
{
"name": "adhocore/json-comment",
@ -1521,16 +1521,16 @@
},
{
"name": "phpstan/phpstan",
"version": "0.12.63",
"version": "0.12.64",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "c97ec4754bd53099a06c24847bd2870b99966b6a"
"reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/c97ec4754bd53099a06c24847bd2870b99966b6a",
"reference": "c97ec4754bd53099a06c24847bd2870b99966b6a",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa",
"reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa",
"shasum": ""
},
"require": {
@ -1561,7 +1561,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/0.12.63"
"source": "https://github.com/phpstan/phpstan/tree/0.12.64"
},
"funding": [
{
@ -1577,7 +1577,7 @@
"type": "tidelift"
}
],
"time": "2020-12-15T16:37:16+00:00"
"time": "2020-12-21T11:59:02+00:00"
},
{
"name": "phpstan/phpstan-phpunit",

View File

@ -48,6 +48,7 @@ use function json_encode;
use function json_last_error_msg;
use function max;
use function mb_strtoupper;
use function microtime;
use function mkdir;
use function ob_end_clean;
use function ob_get_contents;
@ -60,7 +61,6 @@ use function sprintf;
use function str_split;
use function strpos;
use function substr;
use function time;
use function zend_version;
use function zlib_encode;
use const FILE_IGNORE_NEW_LINES;
@ -76,7 +76,7 @@ class CrashDump{
* having their content changed, version format changing, etc.
* It is not necessary to increase this when adding new fields.
*/
private const FORMAT_VERSION = 3;
private const FORMAT_VERSION = 4;
private const PLUGIN_INVOLVEMENT_NONE = "none";
private const PLUGIN_INVOLVEMENT_DIRECT = "direct";
@ -86,7 +86,7 @@ class CrashDump{
private $server;
/** @var resource */
private $fp;
/** @var int */
/** @var float */
private $time;
/**
* @var mixed[]
@ -99,12 +99,12 @@ class CrashDump{
private $path;
public function __construct(Server $server){
$this->time = time();
$this->time = microtime(true);
$this->server = $server;
if(!is_dir($this->server->getDataPath() . "crashdumps")){
mkdir($this->server->getDataPath() . "crashdumps");
}
$this->path = $this->server->getDataPath() . "crashdumps/" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log";
$this->path = $this->server->getDataPath() . "crashdumps/" . date("D_M_j-H.i.s-T_Y", (int) $this->time) . ".log";
$fp = @fopen($this->path, "wb");
if(!is_resource($fp)){
throw new \RuntimeException("Could not create Crash Dump");
@ -112,7 +112,8 @@ class CrashDump{
$this->fp = $fp;
$this->data["format_version"] = self::FORMAT_VERSION;
$this->data["time"] = $this->time;
$this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time));
$this->data["uptime"] = $this->time - $this->server->getStartTime();
$this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", (int) $this->time));
$this->addLine();
$this->baseCrash();
$this->generalData();
@ -152,6 +153,7 @@ class CrashDump{
}
$zlibEncoded = zlib_encode($json, ZLIB_ENCODING_DEFLATE, 9);
if($zlibEncoded === false) throw new AssumptionFailedError("ZLIB compression failed");
$this->encodedData = $zlibEncoded;
foreach(str_split(base64_encode($this->encodedData), 76) as $line){
$this->addLine($line);
}