mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-12 12:55:21 +00:00
Merge branch 'stable' into master
This commit is contained in:
commit
a35ca1fa71
@ -116,7 +116,7 @@ class ExampleClass{
|
|||||||
<!-- TODO: RFC and voting on the forums instead -->
|
<!-- TODO: RFC and voting on the forums instead -->
|
||||||
### RFC and Voting
|
### RFC and Voting
|
||||||
* These are big Pull Requests or contributions that change important behavior.
|
* These are big Pull Requests or contributions that change important behavior.
|
||||||
* RFCs will be tagged with the *PR: RFC* label
|
* RFCs will be tagged with the *Type: Request For Comments* label
|
||||||
* A vote will be held once the RFC is ready. All users can vote commenting on the Pull Request
|
* A vote will be held once the RFC is ready. All users can vote commenting on the Pull Request
|
||||||
* Comments MUST use "Yes" or "No" on the FIRST sentence to signify the vote, except when they don't want it to be counted.
|
* Comments MUST use "Yes" or "No" on the FIRST sentence to signify the vote, except when they don't want it to be counted.
|
||||||
* If your comment is a voting comment, specify the reason of your vote or it won't be counted.
|
* If your comment is a voting comment, specify the reason of your vote or it won't be counted.
|
||||||
|
@ -30,3 +30,11 @@ Plugin developers should **only** update their required API to this version if y
|
|||||||
- Players will now correctly receive the needed number of spawn chunks if they are teleported between `PlayerLoginEvent` and `PlayerJoinEvent`. This fixes a bug that could occur when teleporting players in delayed tasks between login and join.
|
- Players will now correctly receive the needed number of spawn chunks if they are teleported between `PlayerLoginEvent` and `PlayerJoinEvent`. This fixes a bug that could occur when teleporting players in delayed tasks between login and join.
|
||||||
- `PlayerRespawnEvent->setRespawnPosition()` now throws an exception if the provided `Position` has an invalid world associated with it (null or unloaded).
|
- `PlayerRespawnEvent->setRespawnPosition()` now throws an exception if the provided `Position` has an invalid world associated with it (null or unloaded).
|
||||||
- Fixed a crash that occurred when stats reporting was enabled.
|
- Fixed a crash that occurred when stats reporting was enabled.
|
||||||
|
|
||||||
|
# 3.14.3
|
||||||
|
- Fixed deprecation error when running `/whitelist list` on PHP 7.4.
|
||||||
|
- Fixed podzol breaking animation being incorrect (incorrect hardness).
|
||||||
|
- `Entity::getSaveId()` now reports the class name in the message thrown for unregistered entities.
|
||||||
|
- Fixed `CraftingManager->validate()` producing different results when called multiple times for the same transaction.
|
||||||
|
- Fixed various issues with batch-crafting items using the recipe book and shift-clicking.
|
||||||
|
- `tests/plugins/PocketMine-DevTools` submodule has been renamed to `tests/plugins/DevTools`.
|
||||||
|
17
changelogs/3.15.md
Normal file
17
changelogs/3.15.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
**For Minecraft: Bedrock Edition 1.16.20**
|
||||||
|
|
||||||
|
### Note about API versions
|
||||||
|
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
|
||||||
|
Plugin developers should **only** update their required API to this version if you need the changes in this build.
|
||||||
|
|
||||||
|
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
|
||||||
|
|
||||||
|
# 3.15.0
|
||||||
|
- Added support for Minecraft: Bedrock Edition 1.16.20.
|
||||||
|
- Removed compatibility with 1.16.0.
|
||||||
|
|
||||||
|
## Known issues (please don't open issues for these)
|
||||||
|
- Walls don't connect to each other
|
||||||
|
- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon
|
||||||
|
- New blocks, items & mobs aren't implemented
|
||||||
|
- Nether doesn't exist
|
@ -50,7 +50,7 @@
|
|||||||
"respect/validation": "^2.0"
|
"respect/validation": "^2.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "0.12.36",
|
"phpstan/phpstan": "0.12.37",
|
||||||
"phpstan/phpstan-phpunit": "^0.12.6",
|
"phpstan/phpstan-phpunit": "^0.12.6",
|
||||||
"phpstan/phpstan-strict-rules": "^0.12.2",
|
"phpstan/phpstan-strict-rules": "^0.12.2",
|
||||||
"phpunit/phpunit": "^9.2"
|
"phpunit/phpunit": "^9.2"
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 767676e2b97843072220bad719c076b169c28fd3
|
Subproject commit afc885cccae38048d309911f2c5ddcdcb6af8152
|
@ -41,11 +41,11 @@ final class ProtocolInfo{
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** Actual Minecraft: PE protocol version */
|
/** Actual Minecraft: PE protocol version */
|
||||||
public const CURRENT_PROTOCOL = 407;
|
public const CURRENT_PROTOCOL = 408;
|
||||||
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
|
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
|
||||||
public const MINECRAFT_VERSION = 'v1.16.0';
|
public const MINECRAFT_VERSION = 'v1.16.20';
|
||||||
/** Version number sent to clients in ping responses. */
|
/** Version number sent to clients in ping responses. */
|
||||||
public const MINECRAFT_VERSION_NETWORK = '1.16.0';
|
public const MINECRAFT_VERSION_NETWORK = '1.16.20';
|
||||||
|
|
||||||
public const LOGIN_PACKET = 0x01;
|
public const LOGIN_PACKET = 0x01;
|
||||||
public const PLAY_STATUS_PACKET = 0x02;
|
public const PLAY_STATUS_PACKET = 0x02;
|
||||||
|
@ -141,8 +141,8 @@ abstract class TextFormat{
|
|||||||
if(!is_array($string)){
|
if(!is_array($string)){
|
||||||
$string = self::tokenize($string);
|
$string = self::tokenize($string);
|
||||||
}
|
}
|
||||||
$newString = [];
|
$newString = new TextFormatJsonObject();
|
||||||
$pointer =& $newString;
|
$pointer = $newString;
|
||||||
$color = "white";
|
$color = "white";
|
||||||
$bold = false;
|
$bold = false;
|
||||||
$italic = false;
|
$italic = false;
|
||||||
@ -152,165 +152,164 @@ abstract class TextFormat{
|
|||||||
$index = 0;
|
$index = 0;
|
||||||
|
|
||||||
foreach($string as $token){
|
foreach($string as $token){
|
||||||
if(isset($pointer["text"])){
|
if($pointer->text !== null){
|
||||||
if(!isset($newString["extra"])){
|
if($newString->extra === null){
|
||||||
$newString["extra"] = [];
|
$newString->extra = [];
|
||||||
}
|
}
|
||||||
$newString["extra"][$index] = [];
|
$newString->extra[$index] = $pointer = new TextFormatJsonObject();
|
||||||
$pointer =& $newString["extra"][$index];
|
|
||||||
if($color !== "white"){
|
if($color !== "white"){
|
||||||
$pointer["color"] = $color;
|
$pointer->color = $color;
|
||||||
}
|
}
|
||||||
if($bold){
|
if($bold){
|
||||||
$pointer["bold"] = true;
|
$pointer->bold = true;
|
||||||
}
|
}
|
||||||
if($italic){
|
if($italic){
|
||||||
$pointer["italic"] = true;
|
$pointer->italic = true;
|
||||||
}
|
}
|
||||||
if($underlined){
|
if($underlined){
|
||||||
$pointer["underlined"] = true;
|
$pointer->underlined = true;
|
||||||
}
|
}
|
||||||
if($strikethrough){
|
if($strikethrough){
|
||||||
$pointer["strikethrough"] = true;
|
$pointer->strikethrough = true;
|
||||||
}
|
}
|
||||||
if($obfuscated){
|
if($obfuscated){
|
||||||
$pointer["obfuscated"] = true;
|
$pointer->obfuscated = true;
|
||||||
}
|
}
|
||||||
++$index;
|
++$index;
|
||||||
}
|
}
|
||||||
switch($token){
|
switch($token){
|
||||||
case TextFormat::BOLD:
|
case TextFormat::BOLD:
|
||||||
if(!$bold){
|
if(!$bold){
|
||||||
$pointer["bold"] = true;
|
$pointer->bold = true;
|
||||||
$bold = true;
|
$bold = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TextFormat::OBFUSCATED:
|
case TextFormat::OBFUSCATED:
|
||||||
if(!$obfuscated){
|
if(!$obfuscated){
|
||||||
$pointer["obfuscated"] = true;
|
$pointer->obfuscated = true;
|
||||||
$obfuscated = true;
|
$obfuscated = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TextFormat::ITALIC:
|
case TextFormat::ITALIC:
|
||||||
if(!$italic){
|
if(!$italic){
|
||||||
$pointer["italic"] = true;
|
$pointer->italic = true;
|
||||||
$italic = true;
|
$italic = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TextFormat::UNDERLINE:
|
case TextFormat::UNDERLINE:
|
||||||
if(!$underlined){
|
if(!$underlined){
|
||||||
$pointer["underlined"] = true;
|
$pointer->underlined = true;
|
||||||
$underlined = true;
|
$underlined = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TextFormat::STRIKETHROUGH:
|
case TextFormat::STRIKETHROUGH:
|
||||||
if(!$strikethrough){
|
if(!$strikethrough){
|
||||||
$pointer["strikethrough"] = true;
|
$pointer->strikethrough = true;
|
||||||
$strikethrough = true;
|
$strikethrough = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TextFormat::RESET:
|
case TextFormat::RESET:
|
||||||
if($color !== "white"){
|
if($color !== "white"){
|
||||||
$pointer["color"] = "white";
|
$pointer->color = "white";
|
||||||
$color = "white";
|
$color = "white";
|
||||||
}
|
}
|
||||||
if($bold){
|
if($bold){
|
||||||
$pointer["bold"] = false;
|
$pointer->bold = false;
|
||||||
$bold = false;
|
$bold = false;
|
||||||
}
|
}
|
||||||
if($italic){
|
if($italic){
|
||||||
$pointer["italic"] = false;
|
$pointer->italic = false;
|
||||||
$italic = false;
|
$italic = false;
|
||||||
}
|
}
|
||||||
if($underlined){
|
if($underlined){
|
||||||
$pointer["underlined"] = false;
|
$pointer->underlined = false;
|
||||||
$underlined = false;
|
$underlined = false;
|
||||||
}
|
}
|
||||||
if($strikethrough){
|
if($strikethrough){
|
||||||
$pointer["strikethrough"] = false;
|
$pointer->strikethrough = false;
|
||||||
$strikethrough = false;
|
$strikethrough = false;
|
||||||
}
|
}
|
||||||
if($obfuscated){
|
if($obfuscated){
|
||||||
$pointer["obfuscated"] = false;
|
$pointer->obfuscated = false;
|
||||||
$obfuscated = false;
|
$obfuscated = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Colors
|
//Colors
|
||||||
case TextFormat::BLACK:
|
case TextFormat::BLACK:
|
||||||
$pointer["color"] = "black";
|
$pointer->color = "black";
|
||||||
$color = "black";
|
$color = "black";
|
||||||
break;
|
break;
|
||||||
case TextFormat::DARK_BLUE:
|
case TextFormat::DARK_BLUE:
|
||||||
$pointer["color"] = "dark_blue";
|
$pointer->color = "dark_blue";
|
||||||
$color = "dark_blue";
|
$color = "dark_blue";
|
||||||
break;
|
break;
|
||||||
case TextFormat::DARK_GREEN:
|
case TextFormat::DARK_GREEN:
|
||||||
$pointer["color"] = "dark_green";
|
$pointer->color = "dark_green";
|
||||||
$color = "dark_green";
|
$color = "dark_green";
|
||||||
break;
|
break;
|
||||||
case TextFormat::DARK_AQUA:
|
case TextFormat::DARK_AQUA:
|
||||||
$pointer["color"] = "dark_aqua";
|
$pointer->color = "dark_aqua";
|
||||||
$color = "dark_aqua";
|
$color = "dark_aqua";
|
||||||
break;
|
break;
|
||||||
case TextFormat::DARK_RED:
|
case TextFormat::DARK_RED:
|
||||||
$pointer["color"] = "dark_red";
|
$pointer->color = "dark_red";
|
||||||
$color = "dark_red";
|
$color = "dark_red";
|
||||||
break;
|
break;
|
||||||
case TextFormat::DARK_PURPLE:
|
case TextFormat::DARK_PURPLE:
|
||||||
$pointer["color"] = "dark_purple";
|
$pointer->color = "dark_purple";
|
||||||
$color = "dark_purple";
|
$color = "dark_purple";
|
||||||
break;
|
break;
|
||||||
case TextFormat::GOLD:
|
case TextFormat::GOLD:
|
||||||
$pointer["color"] = "gold";
|
$pointer->color = "gold";
|
||||||
$color = "gold";
|
$color = "gold";
|
||||||
break;
|
break;
|
||||||
case TextFormat::GRAY:
|
case TextFormat::GRAY:
|
||||||
$pointer["color"] = "gray";
|
$pointer->color = "gray";
|
||||||
$color = "gray";
|
$color = "gray";
|
||||||
break;
|
break;
|
||||||
case TextFormat::DARK_GRAY:
|
case TextFormat::DARK_GRAY:
|
||||||
$pointer["color"] = "dark_gray";
|
$pointer->color = "dark_gray";
|
||||||
$color = "dark_gray";
|
$color = "dark_gray";
|
||||||
break;
|
break;
|
||||||
case TextFormat::BLUE:
|
case TextFormat::BLUE:
|
||||||
$pointer["color"] = "blue";
|
$pointer->color = "blue";
|
||||||
$color = "blue";
|
$color = "blue";
|
||||||
break;
|
break;
|
||||||
case TextFormat::GREEN:
|
case TextFormat::GREEN:
|
||||||
$pointer["color"] = "green";
|
$pointer->color = "green";
|
||||||
$color = "green";
|
$color = "green";
|
||||||
break;
|
break;
|
||||||
case TextFormat::AQUA:
|
case TextFormat::AQUA:
|
||||||
$pointer["color"] = "aqua";
|
$pointer->color = "aqua";
|
||||||
$color = "aqua";
|
$color = "aqua";
|
||||||
break;
|
break;
|
||||||
case TextFormat::RED:
|
case TextFormat::RED:
|
||||||
$pointer["color"] = "red";
|
$pointer->color = "red";
|
||||||
$color = "red";
|
$color = "red";
|
||||||
break;
|
break;
|
||||||
case TextFormat::LIGHT_PURPLE:
|
case TextFormat::LIGHT_PURPLE:
|
||||||
$pointer["color"] = "light_purple";
|
$pointer->color = "light_purple";
|
||||||
$color = "light_purple";
|
$color = "light_purple";
|
||||||
break;
|
break;
|
||||||
case TextFormat::YELLOW:
|
case TextFormat::YELLOW:
|
||||||
$pointer["color"] = "yellow";
|
$pointer->color = "yellow";
|
||||||
$color = "yellow";
|
$color = "yellow";
|
||||||
break;
|
break;
|
||||||
case TextFormat::WHITE:
|
case TextFormat::WHITE:
|
||||||
$pointer["color"] = "white";
|
$pointer->color = "white";
|
||||||
$color = "white";
|
$color = "white";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$pointer["text"] = $token;
|
$pointer->text = $token;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($newString["extra"])){
|
if($newString->extra !== null){
|
||||||
foreach($newString["extra"] as $k => $d){
|
foreach($newString->extra as $k => $d){
|
||||||
if(!isset($d["text"])){
|
if($d->text === null){
|
||||||
unset($newString["extra"][$k]);
|
unset($newString->extra[$k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
60
src/utils/TextFormatJsonObject.php
Normal file
60
src/utils/TextFormatJsonObject.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?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);
|
||||||
|
|
||||||
|
namespace pocketmine\utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @see TextFormat::toJSON()
|
||||||
|
*/
|
||||||
|
final class TextFormatJsonObject implements \JsonSerializable{
|
||||||
|
/** @var string|null */
|
||||||
|
public $text = null;
|
||||||
|
/** @var string|null */
|
||||||
|
public $color = null;
|
||||||
|
/** @var bool|null */
|
||||||
|
public $bold = null;
|
||||||
|
/** @var bool|null */
|
||||||
|
public $italic = null;
|
||||||
|
/** @var bool|null */
|
||||||
|
public $underlined = null;
|
||||||
|
/** @var bool|null */
|
||||||
|
public $strikethrough = null;
|
||||||
|
/** @var bool|null */
|
||||||
|
public $obfuscated = null;
|
||||||
|
/**
|
||||||
|
* @var TextFormatJsonObject[]|null
|
||||||
|
* @phpstan-var array<int, TextFormatJsonObject>|null
|
||||||
|
*/
|
||||||
|
public $extra = null;
|
||||||
|
|
||||||
|
public function jsonSerialize(){
|
||||||
|
$result = (array) $this;
|
||||||
|
foreach($result as $k => $v){
|
||||||
|
if($v === null){
|
||||||
|
unset($result[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user