Compare commits

..

39 Commits

Author SHA1 Message Date
afb21c1df2 Release 3.19.3 2021-06-08 18:51:48 +01:00
988be2a96b Bump phpunit/phpunit from 9.5.4 to 9.5.5 (#4247)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.4 to 9.5.5.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.4...9.5.5)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-07 21:57:21 +01:00
afe67f7502 Updated build/php submodule to pmmp/php-build-scripts@0a0ac2abb3 2021-06-05 20:18:58 +01:00
b257348a3a Renamed fields of AddEntityPacket and RemoveEntityPacket 2021-06-04 17:18:24 +01:00
12c66d3362 CraftingDataPacket: fixed assert failure on debug builds 2021-06-04 17:13:50 +01:00
92fd2d35a4 SetDisplayObjectivePacket: added order and display slot constants (#4232) 2021-05-24 20:33:24 +01:00
61077c48f1 Worker: fixed quit() usually being useless
Worker::isRunning() returns false after it exits the run() function, even if tasks are stacked and it isn't shutdown.
While this is mostly harmless (since the internal destructor will join the thread anyway), this should be fixed anyway.
2021-05-21 01:24:07 +01:00
e0c61071e1 3.19.3 is next 2021-05-19 22:53:31 +01:00
813d431208 Release 3.19.2 2021-05-19 22:53:30 +01:00
ee112b992d Bump phpstan/phpstan from 0.12.87 to 0.12.88 (#4222)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.87 to 0.12.88.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.87...0.12.88)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-19 00:18:48 +01:00
c9b33e2b9f Bump phpstan/phpstan-phpunit from 0.12.18 to 0.12.19 (#4214)
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 0.12.18 to 0.12.19.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/0.12.18...0.12.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 15:17:18 +01:00
2f2be84b12 Bump phpstan/phpstan from 0.12.86 to 0.12.87 (#4217)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.86 to 0.12.87.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.86...0.12.87)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 12:25:25 +01:00
5a7736b179 actions: go with PHP 7.4.19 2021-05-10 20:30:08 +01:00
e648f1c91e Remove unnecessary script copy 2021-05-10 17:55:52 +01:00
5116e11cea Only install the stuff we need to run PHP, not to build it 2021-05-10 17:55:52 +01:00
9c05e37fbe Bump phpstan/phpstan from 0.12.85 to 0.12.86 (#4212)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.85 to 0.12.86.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.85...0.12.86)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-10 16:53:43 +01:00
fb4796f35e Added PhpStorm code style and file templates 2021-05-07 20:44:46 +01:00
0c2ba66078 Updated build/php submodule to pmmp/php-build-scripts@07129c61d6 2021-05-05 22:15:48 +01:00
c29cd8e2eb actions: added PHP script to update versions 2021-05-04 22:21:45 +01:00
a13b0c98a1 Updated to PHP-CS-Fixer 3.0.0 2021-05-04 22:18:18 +01:00
e6ff908e18 actions: update PHP versions 2021-05-04 21:52:17 +01:00
c47ecb55c0 Sign: Do not allow edits by any player except the one who placed it, and only while that player is online
signs now become finalized if:
- the player quits and rejoins (because the entity runtime ID of the player will not be the same)
- the chunk is unloaded and reloaded (because the tagged entity runtime ID is not saved).

closes #4198
2021-05-02 13:22:31 +01:00
c19d2fe891 Bump phpstan/phpstan from 0.12.84 to 0.12.85 (#4199)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.84 to 0.12.85.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.84...0.12.85)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-05-01 23:24:49 +01:00
f195f24f4f Upgrade to GitHub-native Dependabot (#4201) 2021-05-01 23:24:35 +01:00
4b5f279a3e UseItemOnEntityTransactionData: added missing type 2021-04-29 19:13:52 +01:00
89260d788c 3.19.2 is next 2021-04-25 20:34:13 +01:00
a7cd081002 Release 3.19.1 2021-04-25 20:34:13 +01:00
361be8fe36 Normal: drop MOUNTAINS and SMALL_MOUNTAINS from biome selection
this would cause disruption to generation on a patch release, which is unacceptable.
This would be better for 3.20 or 4.0.
2021-04-25 20:27:19 +01:00
b01e4ab417 Bump phpstan/phpstan from 0.12.83 to 0.12.84 (#4189) 2021-04-21 18:49:08 +00:00
177b963d8e TaskScheduler: do not push cancelled repeating tasks back onto the queue 2021-04-19 13:23:31 +01:00
8d1a1628de Item: Remove "ench" tag when all enchantments are removed from an item (#4184)
fixes #4144
2021-04-18 20:56:07 +01:00
6f80b8979d Particle: added some missing IDs 2021-04-16 18:20:47 +01:00
3c8eb29d4e Limit blockitem metadata hack to just blockitems
for some reason putting NBT on some items makes the creative inventory go haywire. Sadly, we currently need this hack, so I limit it to only stuff which actually needs it (blockitems).
closes #4159
2021-04-16 00:41:19 +01:00
b94bbf6f5e Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-04-16 00:11:01 +01:00
314a8a1297 protocol: updated particle type constants
closes #4173
2021-04-16 00:10:48 +01:00
547503e8f4 Normal: Fixed bug that never lets mountainous terrain generate (#4170) 2021-04-13 17:56:57 +01:00
f74ff1fcd4 Bump adhocore/json-comment from 1.1.0 to 1.1.2 (#4158)
Bumps [adhocore/json-comment](https://github.com/adhocore/php-json-comment) from 1.1.0 to 1.1.2.
- [Release notes](https://github.com/adhocore/php-json-comment/releases)
- [Changelog](https://github.com/adhocore/php-json-comment/blob/main/CHANGELOG.md)
- [Commits](https://github.com/adhocore/php-json-comment/compare/1.1.0...1.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-04-11 16:03:41 +01:00
6c351357ab NetworkBinaryStream: bail if finding unexpected trailing data on item extradata
this may help to discover additional bugs and/or missing data on items that we don't know about yet.
2021-04-11 16:02:41 +01:00
3433406cff 3.19.1 is next 2021-04-07 19:03:36 +01:00
43 changed files with 435 additions and 133 deletions

8
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10

View File

@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
image: [ubuntu-20.04]
php: [7.3.27, 7.4.16]
php: [7.3.28, 7.4.19]
steps:
- uses: actions/checkout@v2 #needed for build.sh
@ -37,7 +37,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.3.27, 7.4.16]
php: [7.3.28, 7.4.19]
steps:
- uses: actions/checkout@v2
@ -55,7 +55,7 @@ jobs:
- name: Install cached PHP's dependencies
if: steps.php-build-cache.outputs.cache-hit == 'true'
run: chmod +x ./bin/php7/install-dependencies.sh && ./bin/php7/install-dependencies.sh
run: ./tests/gh-actions/install-dependencies.sh
- name: Prefix PHP to PATH
run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH
@ -87,7 +87,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.3.27, 7.4.16]
php: [7.3.28, 7.4.19]
steps:
- uses: actions/checkout@v2
@ -105,7 +105,7 @@ jobs:
- name: Install cached PHP's dependencies
if: steps.php-build-cache.outputs.cache-hit == 'true'
run: chmod +x ./bin/php7/install-dependencies.sh && ./bin/php7/install-dependencies.sh
run: ./tests/gh-actions/install-dependencies.sh
- name: Prefix PHP to PATH
run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH
@ -137,7 +137,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.3.27, 7.4.16]
php: [7.3.28, 7.4.19]
steps:
- uses: actions/checkout@v2
@ -157,7 +157,7 @@ jobs:
- name: Install cached PHP's dependencies
if: steps.php-build-cache.outputs.cache-hit == 'true'
run: chmod +x ./bin/php7/install-dependencies.sh && ./bin/php7/install-dependencies.sh
run: ./tests/gh-actions/install-dependencies.sh
- name: Prefix PHP to PATH
run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH
@ -189,7 +189,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.3.27, 7.4.16]
php: [7.3.28, 7.4.19]
steps:
- uses: actions/checkout@v2
@ -209,7 +209,7 @@ jobs:
- name: Install cached PHP's dependencies
if: steps.php-build-cache.outputs.cache-hit == 'true'
run: chmod +x ./bin/php7/install-dependencies.sh && ./bin/php7/install-dependencies.sh
run: ./tests/gh-actions/install-dependencies.sh
- name: Prefix PHP to PATH
run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH
@ -278,4 +278,4 @@ jobs:
tools: php-cs-fixer
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff --diff-format=udiff
run: php-cs-fixer fix --dry-run --diff

View File

@ -0,0 +1,51 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
const VERSIONS = [
"7.3",
"7.4",
"8.0"
];
$workflowFile = file_get_contents(__DIR__ . '/main.yml');
$newWorkflowFile = $workflowFile;
foreach(VERSIONS as $v){
$releaseInfo = file_get_contents("https://secure.php.net/releases?json&version=$v");
if($releaseInfo === false){
throw new \RuntimeException("Failed to contact php.net API");
}
$data = json_decode($releaseInfo, true);
if(!is_array($data) || !isset($data["version"]) || !is_string($data["version"]) || preg_match('/^\d+\.\d+\.\d+(-[A-Za-z\d]+)?$/', $data["version"]) === 0){
throw new \RuntimeException("Invalid data returned by API");
}
$updated = preg_replace("/$v\.\d+/", $data["version"], $newWorkflowFile);
if($updated !== $newWorkflowFile){
echo "Updated $v revision to " . $data["version"] . "\n";
}
$newWorkflowFile = $updated;
}
if($workflowFile !== $newWorkflowFile){
echo "Writing modified workflow file\n";
file_put_contents(__DIR__ . '/main.yml', $newWorkflowFile);
}

5
.gitignore vendored
View File

@ -16,7 +16,9 @@ server.lock
/phpstan.neon
# Common IDEs
.idea/
.idea/*
!.idea/codeStyles/
!.idea/fileTemplates/
nbproject/*
# Windows image file caches
@ -47,3 +49,4 @@ Documentation/*
# php-cs-fixer
/.php_cs.cache
/.php-cs-fixer.cache

71
.idea/codeStyles/Project.xml generated Normal file
View File

@ -0,0 +1,71 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="LINE_SEPARATOR" value="&#10;" />
<HTMLCodeStyleSettings>
<option name="HTML_TEXT_WRAP" value="0" />
<option name="HTML_DO_NOT_INDENT_CHILDREN_OF" value="thead,tbody,tfoot" />
</HTMLCodeStyleSettings>
<PHPCodeStyleSettings>
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="VARIABLE_NAMING_STYLE" value="CAMEL_CASE" />
<option name="SPACES_WITHIN_SHORT_ECHO_TAGS" value="false" />
<option name="SPACE_BEFORE_CLOSURE_LEFT_PARENTHESIS" value="false" />
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
<option name="SPACE_BEFORE_COLON_IN_RETURN_TYPE" value="true" />
</PHPCodeStyleSettings>
<editorconfig>
<option name="ENABLED" value="false" />
</editorconfig>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="CLASS_BRACE_STYLE" value="1" />
<option name="METHOD_BRACE_STYLE" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CATCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CLASS_LBRACE" value="false" />
<option name="SPACE_BEFORE_METHOD_LBRACE" value="false" />
<option name="SPACE_BEFORE_IF_LBRACE" value="false" />
<option name="SPACE_BEFORE_ELSE_LBRACE" value="false" />
<option name="SPACE_BEFORE_WHILE_LBRACE" value="false" />
<option name="SPACE_BEFORE_FOR_LBRACE" value="false" />
<option name="SPACE_BEFORE_DO_LBRACE" value="false" />
<option name="SPACE_BEFORE_SWITCH_LBRACE" value="false" />
<option name="SPACE_BEFORE_TRY_LBRACE" value="false" />
<option name="SPACE_BEFORE_CATCH_LBRACE" value="false" />
<option name="SPACE_BEFORE_FINALLY_LBRACE" value="false" />
<option name="SPACE_BEFORE_ELSE_KEYWORD" value="false" />
<option name="SPACE_BEFORE_WHILE_KEYWORD" value="false" />
<option name="SPACE_BEFORE_CATCH_KEYWORD" value="false" />
<option name="SPACE_BEFORE_FINALLY_KEYWORD" value="false" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="neon">
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -0,0 +1,8 @@
#if(${THROWS_DOC} != "")
/**
${THROWS_DOC}
*/
#end
public function __construct(${PARAM_LIST}) {
${BODY}
}

View File

@ -0,0 +1,6 @@
/** @return $this */
public function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #else#end$${PARAM_NAME})#if(${RETURN_TYPE}): self#else#end
{
$this->${FIELD_NAME} = $${PARAM_NAME};
return $this;
}

View File

@ -0,0 +1,3 @@
#if(${TYPE_HINT} != ${RETURN_TYPE} && ${TYPE_HINT} != "")/** @return ${TYPE_HINT} */#end
public ${STATIC} function ${GET_OR_IS}${NAME}()#if(${RETURN_TYPE}): ${RETURN_TYPE}#else#end
{ return #if(${STATIC} == "static")self::$${FIELD_NAME};#else$this->${FIELD_NAME};#end }

View File

@ -0,0 +1,2 @@
public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #end$${PARAM_NAME})#if (${VOID_RETURN_TYPE}):void #end
{#if (${STATIC} == "static") self::$${FIELD_NAME} = $${PARAM_NAME}; #else $this->${FIELD_NAME} = $${PARAM_NAME}; #end}

View File

View File

@ -0,0 +1,21 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);

View File

@ -0,0 +1,5 @@
#if (${THROWS_DOC} != "")
/**
${THROWS_DOC}
*/
#end

View File

@ -0,0 +1 @@
/** @var ${TYPE_HINT} */

View File

View File

@ -0,0 +1,10 @@
<?php
#parse("PHP File Header.php")
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
final class ${NAME} {
}

View File

@ -0,0 +1,4 @@
<?php
#parse("PHP File Header.php")

View File

@ -0,0 +1,10 @@
<?php
#parse("PHP File Header.php")
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
interface ${NAME} {
}

View File

@ -0,0 +1,10 @@
<?php
#parse("PHP File Header.php")
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
trait ${NAME} {
}

View File

@ -9,7 +9,7 @@ $finder = PhpCsFixer\Finder::create()
->notContains('#ifndef COMPILE') //preprocessor will break if these are changed
->notName('PocketMine.php');
return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config)
->setRiskyAllowed(true)
->setRules([
'align_multiline_comment' => [

View File

@ -15,3 +15,12 @@ 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.19.1
- Fixed some particles not working since 1.16.220.
- Fixed issues with creative inventory items appearing in the wrong places since 1.16.220.
- `Item->removeEnchantment()` now removes the `ench` tag from item NBT when removing the only enchantment on an item.
- Fixed temporary memory leak of repeating tasks which cancelled themselves during their `onRun()` handler (they were pushed back onto the task queue even though cancelled, and only removed at their next attempted repeat).
# 3.19.2
- Signs can now only be edited by the player who placed them. They will become finalized if the chunk containing them is unloaded and reloaded, or if the creating player quits the server.

View File

@ -38,7 +38,7 @@
"pocketmine/spl": "^0.4.0"
},
"require-dev": {
"phpstan/phpstan": "0.12.83",
"phpstan/phpstan": "0.12.88",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^9.2"

92
composer.lock generated
View File

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c07802390fc058bf06b3a1741ef7c08e",
"content-hash": "f44a7138679bc86f4feecb9f3dbf7f1a",
"packages": [
{
"name": "adhocore/json-comment",
"version": "1.1.0",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/adhocore/php-json-comment.git",
"reference": "cf7998124d1050b83d7d985447fefd630e09c1a2"
"reference": "fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/adhocore/php-json-comment/zipball/cf7998124d1050b83d7d985447fefd630e09c1a2",
"reference": "cf7998124d1050b83d7d985447fefd630e09c1a2",
"url": "https://api.github.com/repos/adhocore/php-json-comment/zipball/fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7",
"reference": "fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7",
"shasum": ""
},
"require": {
@ -51,7 +51,7 @@
],
"support": {
"issues": "https://github.com/adhocore/php-json-comment/issues",
"source": "https://github.com/adhocore/php-json-comment/tree/1.1.0"
"source": "https://github.com/adhocore/php-json-comment/tree/1.1.2"
},
"funding": [
{
@ -59,7 +59,7 @@
"type": "custom"
}
],
"time": "2021-04-05T13:11:13+00:00"
"time": "2021-04-09T03:06:06+00:00"
},
{
"name": "pocketmine/binaryutils",
@ -617,16 +617,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.10.4",
"version": "v4.10.5",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e"
"reference": "4432ba399e47c66624bc73c8c0f811e5c109576f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e",
"reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4432ba399e47c66624bc73c8c0f811e5c109576f",
"reference": "4432ba399e47c66624bc73c8c0f811e5c109576f",
"shasum": ""
},
"require": {
@ -667,9 +667,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.10.5"
},
"time": "2020-12-20T10:01:03+00:00"
"time": "2021-05-03T19:11:20+00:00"
},
{
"name": "phar-io/manifest",
@ -1009,16 +1009,16 @@
},
{
"name": "phpstan/phpstan",
"version": "0.12.83",
"version": "0.12.88",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "4a967cec6efb46b500dd6d768657336a3ffe699f"
"reference": "464d1a81af49409c41074aa6640ed0c4cbd9bb68"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/4a967cec6efb46b500dd6d768657336a3ffe699f",
"reference": "4a967cec6efb46b500dd6d768657336a3ffe699f",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/464d1a81af49409c41074aa6640ed0c4cbd9bb68",
"reference": "464d1a81af49409c41074aa6640ed0c4cbd9bb68",
"shasum": ""
},
"require": {
@ -1049,7 +1049,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/0.12.83"
"source": "https://github.com/phpstan/phpstan/tree/0.12.88"
},
"funding": [
{
@ -1065,25 +1065,25 @@
"type": "tidelift"
}
],
"time": "2021-04-03T15:35:45+00:00"
"time": "2021-05-17T12:24:49+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
"version": "0.12.18",
"version": "0.12.19",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "ab44aec7cfb5cb267b8bc30a8caea86dd50d1f72"
"reference": "52f7072ddc5f81492f9d2de65a24813a48c90b18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/ab44aec7cfb5cb267b8bc30a8caea86dd50d1f72",
"reference": "ab44aec7cfb5cb267b8bc30a8caea86dd50d1f72",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/52f7072ddc5f81492f9d2de65a24813a48c90b18",
"reference": "52f7072ddc5f81492f9d2de65a24813a48c90b18",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^0.12.60"
"phpstan/phpstan": "^0.12.86"
},
"conflict": {
"phpunit/phpunit": "<7.0"
@ -1118,9 +1118,9 @@
"description": "PHPUnit extensions and rules for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-phpunit/issues",
"source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.18"
"source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.19"
},
"time": "2021-03-06T11:51:27+00:00"
"time": "2021-04-30T11:10:37+00:00"
},
{
"name": "phpstan/phpstan-strict-rules",
@ -1493,16 +1493,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.4",
"version": "9.5.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "c73c6737305e779771147af66c96ca6a7ed8a741"
"reference": "89ff45ea9d70e35522fb6654a2ebc221158de276"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c73c6737305e779771147af66c96ca6a7ed8a741",
"reference": "c73c6737305e779771147af66c96ca6a7ed8a741",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/89ff45ea9d70e35522fb6654a2ebc221158de276",
"reference": "89ff45ea9d70e35522fb6654a2ebc221158de276",
"shasum": ""
},
"require": {
@ -1532,7 +1532,7 @@
"sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^2.3",
"sebastian/type": "^2.3.2",
"sebastian/version": "^3.0.2"
},
"require-dev": {
@ -1580,7 +1580,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.4"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.5"
},
"funding": [
{
@ -1592,7 +1592,7 @@
"type": "github"
}
],
"time": "2021-03-23T07:16:29+00:00"
"time": "2021-06-05T04:49:07+00:00"
},
{
"name": "sebastian/cli-parser",
@ -2451,16 +2451,16 @@
},
{
"name": "sebastian/type",
"version": "2.3.1",
"version": "2.3.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2"
"reference": "0d1c587401514d17e8f9258a27e23527cb1b06c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2",
"reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0d1c587401514d17e8f9258a27e23527cb1b06c1",
"reference": "0d1c587401514d17e8f9258a27e23527cb1b06c1",
"shasum": ""
},
"require": {
@ -2495,7 +2495,7 @@
"homepage": "https://github.com/sebastianbergmann/type",
"support": {
"issues": "https://github.com/sebastianbergmann/type/issues",
"source": "https://github.com/sebastianbergmann/type/tree/2.3.1"
"source": "https://github.com/sebastianbergmann/type/tree/2.3.2"
},
"funding": [
{
@ -2503,7 +2503,7 @@
"type": "github"
}
],
"time": "2020-10-26T13:18:59+00:00"
"time": "2021-06-04T13:02:07+00:00"
},
{
"name": "sebastian/version",
@ -2560,16 +2560,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.22.1",
"version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
"reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"shasum": ""
},
"require": {
@ -2581,7 +2581,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.22-dev"
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -2619,7 +2619,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0"
},
"funding": [
{
@ -2635,7 +2635,7 @@
"type": "tidelift"
}
],
"time": "2021-01-07T16:49:33+00:00"
"time": "2021-02-19T12:13:01+00:00"
},
{
"name": "theseer/tokenizer",

View File

@ -33,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
const _VERSION_INFO_INCLUDED = true;
const NAME = "PocketMine-MP";
const BASE_VERSION = "3.19.0";
const BASE_VERSION = "3.19.3";
const IS_DEVELOPMENT_BUILD = false;
const BUILD_NUMBER = 0;

View File

@ -95,7 +95,7 @@ abstract class Worker extends \Worker{
public function quit(){
$this->isKilled = true;
if($this->isRunning()){
if(!$this->isShutdown()){
while($this->unstack() !== null);
$this->notify();
$this->shutdown();

View File

@ -68,7 +68,10 @@ class SignPost extends Transparent{
$this->getLevelNonNull()->setBlock($blockReplace, BlockFactory::get(Block::WALL_SIGN, $this->meta), true);
}
Tile::createTile(Tile::SIGN, $this->getLevelNonNull(), TileSign::createNBT($this, $face, $item, $player));
$sign = Tile::createTile(Tile::SIGN, $this->getLevelNonNull(), TileSign::createNBT($this, $face, $item, $player));
if($player !== null && $sign instanceof TileSign){
$sign->setEditorEntityRuntimeId($player->getId());
}
return true;
}

View File

@ -339,7 +339,11 @@ class Item implements ItemIds, \JsonSerializable{
}
}
$this->setNamedTagEntry($ench);
if($ench->getCount() > 0){
$this->setNamedTagEntry($ench);
}else{
$this->removeNamedTagEntry(self::TAG_ENCH);
}
}
public function removeEnchantments() : void{

View File

@ -144,16 +144,9 @@ class Normal extends Generator{
return Biome::BIRCH_FOREST;
}
}else{
//FIXME: This will always cause River to be used since the rainfall is always greater than 0.8 if we
//reached this branch. However I don't think that substituting temperature for rainfall is correct given
//that mountain biomes are supposed to be pretty cold.
if($rainfall < 0.25){
return Biome::MOUNTAINS;
}elseif($rainfall < 0.70){
return Biome::SMALL_MOUNTAINS;
}else{
return Biome::RIVER;
}
//Previously here, we had a (broken) condition to generate mountains, but fixing it would have
//caused generation changes on a patch release, so we can't keep it here for now.
return Biome::RIVER;
}
}
};

View File

@ -56,45 +56,58 @@ abstract class Particle extends Vector3{
public const TYPE_DRIP_WATER = 26;
public const TYPE_DRIP_LAVA = 27;
public const TYPE_DRIP_HONEY = 28;
public const TYPE_FALLING_DUST = 29, TYPE_DUST = 29;
public const TYPE_MOB_SPELL = 30;
public const TYPE_MOB_SPELL_AMBIENT = 31;
public const TYPE_MOB_SPELL_INSTANTANEOUS = 32;
public const TYPE_INK = 33;
public const TYPE_SLIME = 34;
public const TYPE_RAIN_SPLASH = 35;
public const TYPE_VILLAGER_ANGRY = 36;
public const TYPE_VILLAGER_HAPPY = 37;
public const TYPE_ENCHANTMENT_TABLE = 38;
public const TYPE_TRACKING_EMITTER = 39;
public const TYPE_NOTE = 40;
public const TYPE_WITCH_SPELL = 41;
public const TYPE_CARROT = 42;
public const TYPE_MOB_APPEARANCE = 43;
public const TYPE_END_ROD = 44;
public const TYPE_DRAGONS_BREATH = 45;
public const TYPE_SPIT = 46;
public const TYPE_TOTEM = 47;
public const TYPE_FOOD = 48;
public const TYPE_FIREWORKS_STARTER = 49;
public const TYPE_FIREWORKS_SPARK = 50;
public const TYPE_FIREWORKS_OVERLAY = 51;
public const TYPE_BALLOON_GAS = 52;
public const TYPE_COLORED_FLAME = 53;
public const TYPE_SPARKLER = 54;
public const TYPE_CONDUIT = 55;
public const TYPE_BUBBLE_COLUMN_UP = 56;
public const TYPE_BUBBLE_COLUMN_DOWN = 57;
public const TYPE_SNEEZE = 58;
public const TYPE_SHULKER_BULLET = 59;
public const TYPE_BLEACH = 60;
public const TYPE_DRAGON_DESTROY_BLOCK = 61;
public const TYPE_MYCELIUM_DUST = 62;
public const TYPE_FALLING_RED_DUST = 63;
public const TYPE_CAMPFIRE_SMOKE = 64;
public const TYPE_TALL_CAMPFIRE_SMOKE = 65;
public const TYPE_DRAGON_BREATH_FIRE = 66;
public const TYPE_DRAGON_BREATH_TRAIL = 67;
public const TYPE_STALACTITE_DRIP_WATER = 29;
public const TYPE_STALACTITE_DRIP_LAVA = 30;
public const TYPE_FALLING_DUST = 31, TYPE_DUST = 31;
public const TYPE_MOB_SPELL = 32;
public const TYPE_MOB_SPELL_AMBIENT = 33;
public const TYPE_MOB_SPELL_INSTANTANEOUS = 34;
public const TYPE_INK = 35;
public const TYPE_SLIME = 36;
public const TYPE_RAIN_SPLASH = 37;
public const TYPE_VILLAGER_ANGRY = 38;
public const TYPE_VILLAGER_HAPPY = 39;
public const TYPE_ENCHANTMENT_TABLE = 40;
public const TYPE_TRACKING_EMITTER = 41;
public const TYPE_NOTE = 42;
public const TYPE_WITCH_SPELL = 43;
public const TYPE_CARROT = 44;
public const TYPE_MOB_APPEARANCE = 45;
public const TYPE_END_ROD = 46;
public const TYPE_DRAGONS_BREATH = 47;
public const TYPE_SPIT = 48;
public const TYPE_TOTEM = 49;
public const TYPE_FOOD = 50;
public const TYPE_FIREWORKS_STARTER = 51;
public const TYPE_FIREWORKS_SPARK = 52;
public const TYPE_FIREWORKS_OVERLAY = 53;
public const TYPE_BALLOON_GAS = 54;
public const TYPE_COLORED_FLAME = 55;
public const TYPE_SPARKLER = 56;
public const TYPE_CONDUIT = 57;
public const TYPE_BUBBLE_COLUMN_UP = 58;
public const TYPE_BUBBLE_COLUMN_DOWN = 59;
public const TYPE_SNEEZE = 60;
public const TYPE_SHULKER_BULLET = 61;
public const TYPE_BLEACH = 62;
public const TYPE_DRAGON_DESTROY_BLOCK = 63;
public const TYPE_MYCELIUM_DUST = 64;
public const TYPE_FALLING_RED_DUST = 65;
public const TYPE_CAMPFIRE_SMOKE = 66;
public const TYPE_TALL_CAMPFIRE_SMOKE = 67;
public const TYPE_DRAGON_BREATH_FIRE = 68;
public const TYPE_DRAGON_BREATH_TRAIL = 69;
public const TYPE_BLUE_FLAME = 70;
public const TYPE_SOUL = 71;
public const TYPE_OBSIDIAN_TEAR = 72;
public const TYPE_PORTAL_REVERSE = 73;
public const TYPE_SNOWFLAKE = 74;
public const TYPE_VIBRATION_SIGNAL = 75;
public const TYPE_SCULK_SENSOR_REDSTONE = 76;
public const TYPE_SPORE_BLOSSOM_SHOWER = 77;
public const TYPE_SPORE_BLOSSOM_AMBIENT = 78;
public const TYPE_WAX = 79;
public const TYPE_ELECTRIC_SPARK = 80;
/**
* @return DataPacket|DataPacket[]

View File

@ -260,6 +260,11 @@ class NetworkBinaryStream extends BinaryStream{
if($netId === ItemTypeDictionary::getInstance()->fromStringId("minecraft:shield")){
$extraData->getLLong(); //"blocking tick" (ffs mojang)
}
if(!$extraData->feof()){
throw new \UnexpectedValueException("Unexpected trailing extradata for network item $netId");
}
if($nbt !== null){
if($nbt->hasTag(self::DAMAGE_TAG, IntTag::class)){
$meta = $nbt->getInt(self::DAMAGE_TAG);
@ -305,8 +310,15 @@ class NetworkBinaryStream extends BinaryStream{
$writeExtraCrapInTheMiddle($this);
$block = $item->getBlock();
$this->putVarInt($block->getId() === BlockIds::AIR ? 0 : RuntimeBlockMapping::toStaticRuntimeId($block->getId(), $block->getDamage()));
$blockRuntimeId = 0;
$isBlockItem = $item->getId() < 256;
if($isBlockItem){
$block = $item->getBlock();
if($block->getId() !== BlockIds::AIR){
$blockRuntimeId = RuntimeBlockMapping::toStaticRuntimeId($block->getId(), $block->getDamage());
}
}
$this->putVarInt($blockRuntimeId);
$nbt = null;
if($item->hasCompoundTag()){
@ -323,7 +335,7 @@ class NetworkBinaryStream extends BinaryStream{
$nbt = new CompoundTag();
}
$nbt->setInt(self::DAMAGE_TAG, $coreData);
}elseif($block->getId() !== BlockIds::AIR && $coreData !== 0){
}elseif($isBlockItem && $coreData !== 0){
//TODO HACK: This foul-smelling code ensures that we can correctly deserialize an item when the
//client sends it back to us, because as of 1.16.220, blockitems quietly discard their metadata
//client-side. Aside from being very annoying, this also breaks various server-side behaviours.

View File

@ -31,24 +31,24 @@ class AddEntityPacket extends DataPacket/* implements ClientboundPacket*/{
public const NETWORK_ID = ProtocolInfo::ADD_ENTITY_PACKET;
/** @var int */
private $uvarint1;
private $entityNetId;
public static function create(int $uvarint1) : self{
public static function create(int $entityNetId) : self{
$result = new self;
$result->uvarint1 = $uvarint1;
$result->entityNetId = $entityNetId;
return $result;
}
public function getUvarint1() : int{
return $this->uvarint1;
public function getEntityNetId() : int{
return $this->entityNetId;
}
protected function decodePayload() : void{
$this->uvarint1 = $this->getUnsignedVarInt();
$this->entityNetId = $this->getUnsignedVarInt();
}
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->uvarint1);
$this->putUnsignedVarInt($this->entityNetId);
}
public function handle(NetworkSession $handler) : bool{

View File

@ -276,7 +276,7 @@ class CraftingDataPacket extends DataPacket{
$writer = new NetworkBinaryStream();
$counter = 0;
foreach($this->entries as $d){
$entryType = self::writeEntry($d, $writer, $counter++);
$entryType = self::writeEntry($d, $writer, ++$counter);
if($entryType >= 0){
$this->putVarInt($entryType);
$this->put($writer->getBuffer());

View File

@ -31,24 +31,24 @@ class RemoveEntityPacket extends DataPacket/* implements ClientboundPacket*/{
public const NETWORK_ID = ProtocolInfo::REMOVE_ENTITY_PACKET;
/** @var int */
private $uvarint1;
private $entityNetId;
public static function create(int $uvarint1) : self{
public static function create(int $entityNetId) : self{
$result = new self;
$result->uvarint1 = $uvarint1;
$result->entityNetId = $entityNetId;
return $result;
}
public function getUvarint1() : int{
return $this->uvarint1;
public function getEntityNetId() : int{
return $this->entityNetId;
}
protected function decodePayload() : void{
$this->uvarint1 = $this->getUnsignedVarInt();
$this->entityNetId = $this->getUnsignedVarInt();
}
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->uvarint1);
$this->putUnsignedVarInt($this->entityNetId);
}
public function handle(NetworkSession $handler) : bool{

View File

@ -30,6 +30,13 @@ use pocketmine\network\mcpe\NetworkSession;
class SetDisplayObjectivePacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::SET_DISPLAY_OBJECTIVE_PACKET;
public const DISPLAY_SLOT_LIST = "list";
public const DISPLAY_SLOT_SIDEBAR = "sidebar";
public const DISPLAY_SLOT_BELOW_NAME = "belowname";
public const SORT_ORDER_ASCENDING = 0;
public const SORT_ORDER_DESCENDING = 1;
/** @var string */
public $displaySlot;
/** @var string */

View File

@ -31,6 +31,7 @@ use pocketmine\network\mcpe\protocol\types\NetworkInventoryAction;
class UseItemOnEntityTransactionData extends TransactionData{
public const ACTION_INTERACT = 0;
public const ACTION_ATTACK = 1;
public const ACTION_ITEM_INTERACT = 2;
/** @var int */
private $entityRuntimeId;

View File

@ -177,7 +177,7 @@ class TaskScheduler{
continue;
}
$task->run($this->currentTick);
if($task->isRepeating()){
if(!$task->isCancelled() && $task->isRepeating()){
$task->setNextRun($this->currentTick + $task->getPeriod());
$this->queue->insert($task, $this->currentTick + $task->getPeriod());
}else{

View File

@ -52,6 +52,9 @@ class Sign extends Spawnable{
/** @var string[] */
protected $text = ["", "", "", ""];
/** @var int|null */
protected $editorEntityRuntimeId = null;
protected function readSaveData(CompoundTag $nbt) : void{
if($nbt->hasTag(self::TAG_TEXT_BLOB, StringTag::class)){ //MCPE 1.2 save format
$this->text = self::fixTextBlob($nbt->getString(self::TAG_TEXT_BLOB));
@ -132,6 +135,22 @@ class Sign extends Spawnable{
return $this->text;
}
/**
* Returns the entity runtime ID of the player who placed this sign. Only the player whose entity ID matches this
* one may edit the sign text.
* This is needed because as of 1.16.220, there is still no reliable way to detect when the MCPE client closed the
* sign edit GUI, so we have no way to know when the text is finalized. This limits editing of the text to only the
* player who placed it, and only while that player is online.
* We can say for sure that the sign is finalized if either of the following occurs:
* - The player quits (after rejoin, the player's entity runtimeID will be different).
* - The chunk is unloaded (on next load, the entity runtimeID will be null, because it's not saved).
*/
public function getEditorEntityRuntimeId() : ?int{ return $this->editorEntityRuntimeId; }
public function setEditorEntityRuntimeId(?int $editorEntityRuntimeId) : void{
$this->editorEntityRuntimeId = $editorEntityRuntimeId;
}
protected function addAdditionalSpawnData(CompoundTag $nbt) : void{
$nbt->setString(self::TAG_TEXT_BLOB, implode("\n", $this->text));
}
@ -158,6 +177,9 @@ class Sign extends Spawnable{
$removeFormat = $player->getRemoveFormat();
$ev = new SignChangeEvent($this->getBlock(), $player, array_map(function(string $line) use ($removeFormat) : string{ return TextFormat::clean($line, $removeFormat); }, $lines));
if($this->editorEntityRuntimeId === null || $this->editorEntityRuntimeId !== $player->getId()){
$ev->setCancelled();
}
$ev->call();
if(!$ev->isCancelled()){

View File

@ -23,4 +23,3 @@ cd php-build
echo '"pthreads",,"https://github.com/pmmp/pthreads.git",,,"extension",' >> share/php-build/extension/definition
PHP_BUILD_INSTALL_EXTENSION='pthreads=@acc6e52b2144c61c434b62a3cb680d537e06828e yaml=2.2.1' PHP_BUILD_ZTS_ENABLE=on ./bin/php-build "$VERSION" "$INSTALL_DIR" || exit 1
rm "$INSTALL_DIR/etc/conf.d/xdebug.ini" || true
cp install-dependencies.sh "$INSTALL_DIR"

View File

@ -0,0 +1,3 @@
#!/bin/bash
sudo apt update && sudo apt install -y \
libzip5

View File

@ -1605,6 +1605,11 @@ parameters:
count: 1
path: ../../../src/pocketmine/utils/Utils.php
-
message: "#^Parameter \\#1 \\$enchantment of class pocketmine\\\\item\\\\enchantment\\\\EnchantmentInstance constructor expects pocketmine\\\\item\\\\enchantment\\\\Enchantment, pocketmine\\\\item\\\\enchantment\\\\Enchantment\\|null given\\.$#"
count: 1
path: ../../phpunit/item/ItemTest.php
-
message: "#^Cannot call method cancel\\(\\) on pocketmine\\\\scheduler\\\\TaskHandler\\|null\\.$#"
count: 1

View File

@ -25,12 +25,15 @@ namespace pocketmine\item;
use PHPUnit\Framework\TestCase;
use pocketmine\block\BlockFactory;
use pocketmine\item\enchantment\Enchantment;
use pocketmine\item\enchantment\EnchantmentInstance;
class ItemTest extends TestCase{
public function setUp() : void{
BlockFactory::init();
ItemFactory::init();
Enchantment::init();
}
/**
@ -61,6 +64,16 @@ class ItemTest extends TestCase{
}
}
/**
* Tests that when all enchantments are removed from an item, the "ench" tag is removed as well
*/
public function testEnchantmentRemoval() : void{
$item = ItemFactory::get(Item::DIAMOND_SWORD);
$item->addEnchantment(new EnchantmentInstance(Enchantment::getEnchantment(Enchantment::SHARPNESS)));
$item->removeEnchantment(Enchantment::SHARPNESS);
self::assertNull($item->getNamedTag()->getTag(Item::TAG_ENCH));
}
/**
* @return mixed[][]
* @phpstan-return list<array{string,int,int}>