mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +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 -->
|
||||
### RFC and Voting
|
||||
* 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
|
||||
* 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.
|
||||
|
@ -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.
|
||||
- `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.
|
||||
|
||||
# 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"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "0.12.36",
|
||||
"phpstan/phpstan": "0.12.37",
|
||||
"phpstan/phpstan-phpunit": "^0.12.6",
|
||||
"phpstan/phpstan-strict-rules": "^0.12.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 */
|
||||
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. */
|
||||
public const MINECRAFT_VERSION = 'v1.16.0';
|
||||
public const MINECRAFT_VERSION = 'v1.16.20';
|
||||
/** 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 PLAY_STATUS_PACKET = 0x02;
|
||||
|
@ -141,8 +141,8 @@ abstract class TextFormat{
|
||||
if(!is_array($string)){
|
||||
$string = self::tokenize($string);
|
||||
}
|
||||
$newString = [];
|
||||
$pointer =& $newString;
|
||||
$newString = new TextFormatJsonObject();
|
||||
$pointer = $newString;
|
||||
$color = "white";
|
||||
$bold = false;
|
||||
$italic = false;
|
||||
@ -152,165 +152,164 @@ abstract class TextFormat{
|
||||
$index = 0;
|
||||
|
||||
foreach($string as $token){
|
||||
if(isset($pointer["text"])){
|
||||
if(!isset($newString["extra"])){
|
||||
$newString["extra"] = [];
|
||||
if($pointer->text !== null){
|
||||
if($newString->extra === null){
|
||||
$newString->extra = [];
|
||||
}
|
||||
$newString["extra"][$index] = [];
|
||||
$pointer =& $newString["extra"][$index];
|
||||
$newString->extra[$index] = $pointer = new TextFormatJsonObject();
|
||||
if($color !== "white"){
|
||||
$pointer["color"] = $color;
|
||||
$pointer->color = $color;
|
||||
}
|
||||
if($bold){
|
||||
$pointer["bold"] = true;
|
||||
$pointer->bold = true;
|
||||
}
|
||||
if($italic){
|
||||
$pointer["italic"] = true;
|
||||
$pointer->italic = true;
|
||||
}
|
||||
if($underlined){
|
||||
$pointer["underlined"] = true;
|
||||
$pointer->underlined = true;
|
||||
}
|
||||
if($strikethrough){
|
||||
$pointer["strikethrough"] = true;
|
||||
$pointer->strikethrough = true;
|
||||
}
|
||||
if($obfuscated){
|
||||
$pointer["obfuscated"] = true;
|
||||
$pointer->obfuscated = true;
|
||||
}
|
||||
++$index;
|
||||
}
|
||||
switch($token){
|
||||
case TextFormat::BOLD:
|
||||
if(!$bold){
|
||||
$pointer["bold"] = true;
|
||||
$pointer->bold = true;
|
||||
$bold = true;
|
||||
}
|
||||
break;
|
||||
case TextFormat::OBFUSCATED:
|
||||
if(!$obfuscated){
|
||||
$pointer["obfuscated"] = true;
|
||||
$pointer->obfuscated = true;
|
||||
$obfuscated = true;
|
||||
}
|
||||
break;
|
||||
case TextFormat::ITALIC:
|
||||
if(!$italic){
|
||||
$pointer["italic"] = true;
|
||||
$pointer->italic = true;
|
||||
$italic = true;
|
||||
}
|
||||
break;
|
||||
case TextFormat::UNDERLINE:
|
||||
if(!$underlined){
|
||||
$pointer["underlined"] = true;
|
||||
$pointer->underlined = true;
|
||||
$underlined = true;
|
||||
}
|
||||
break;
|
||||
case TextFormat::STRIKETHROUGH:
|
||||
if(!$strikethrough){
|
||||
$pointer["strikethrough"] = true;
|
||||
$pointer->strikethrough = true;
|
||||
$strikethrough = true;
|
||||
}
|
||||
break;
|
||||
case TextFormat::RESET:
|
||||
if($color !== "white"){
|
||||
$pointer["color"] = "white";
|
||||
$pointer->color = "white";
|
||||
$color = "white";
|
||||
}
|
||||
if($bold){
|
||||
$pointer["bold"] = false;
|
||||
$pointer->bold = false;
|
||||
$bold = false;
|
||||
}
|
||||
if($italic){
|
||||
$pointer["italic"] = false;
|
||||
$pointer->italic = false;
|
||||
$italic = false;
|
||||
}
|
||||
if($underlined){
|
||||
$pointer["underlined"] = false;
|
||||
$pointer->underlined = false;
|
||||
$underlined = false;
|
||||
}
|
||||
if($strikethrough){
|
||||
$pointer["strikethrough"] = false;
|
||||
$pointer->strikethrough = false;
|
||||
$strikethrough = false;
|
||||
}
|
||||
if($obfuscated){
|
||||
$pointer["obfuscated"] = false;
|
||||
$pointer->obfuscated = false;
|
||||
$obfuscated = false;
|
||||
}
|
||||
break;
|
||||
|
||||
//Colors
|
||||
case TextFormat::BLACK:
|
||||
$pointer["color"] = "black";
|
||||
$pointer->color = "black";
|
||||
$color = "black";
|
||||
break;
|
||||
case TextFormat::DARK_BLUE:
|
||||
$pointer["color"] = "dark_blue";
|
||||
$pointer->color = "dark_blue";
|
||||
$color = "dark_blue";
|
||||
break;
|
||||
case TextFormat::DARK_GREEN:
|
||||
$pointer["color"] = "dark_green";
|
||||
$pointer->color = "dark_green";
|
||||
$color = "dark_green";
|
||||
break;
|
||||
case TextFormat::DARK_AQUA:
|
||||
$pointer["color"] = "dark_aqua";
|
||||
$pointer->color = "dark_aqua";
|
||||
$color = "dark_aqua";
|
||||
break;
|
||||
case TextFormat::DARK_RED:
|
||||
$pointer["color"] = "dark_red";
|
||||
$pointer->color = "dark_red";
|
||||
$color = "dark_red";
|
||||
break;
|
||||
case TextFormat::DARK_PURPLE:
|
||||
$pointer["color"] = "dark_purple";
|
||||
$pointer->color = "dark_purple";
|
||||
$color = "dark_purple";
|
||||
break;
|
||||
case TextFormat::GOLD:
|
||||
$pointer["color"] = "gold";
|
||||
$pointer->color = "gold";
|
||||
$color = "gold";
|
||||
break;
|
||||
case TextFormat::GRAY:
|
||||
$pointer["color"] = "gray";
|
||||
$pointer->color = "gray";
|
||||
$color = "gray";
|
||||
break;
|
||||
case TextFormat::DARK_GRAY:
|
||||
$pointer["color"] = "dark_gray";
|
||||
$pointer->color = "dark_gray";
|
||||
$color = "dark_gray";
|
||||
break;
|
||||
case TextFormat::BLUE:
|
||||
$pointer["color"] = "blue";
|
||||
$pointer->color = "blue";
|
||||
$color = "blue";
|
||||
break;
|
||||
case TextFormat::GREEN:
|
||||
$pointer["color"] = "green";
|
||||
$pointer->color = "green";
|
||||
$color = "green";
|
||||
break;
|
||||
case TextFormat::AQUA:
|
||||
$pointer["color"] = "aqua";
|
||||
$pointer->color = "aqua";
|
||||
$color = "aqua";
|
||||
break;
|
||||
case TextFormat::RED:
|
||||
$pointer["color"] = "red";
|
||||
$pointer->color = "red";
|
||||
$color = "red";
|
||||
break;
|
||||
case TextFormat::LIGHT_PURPLE:
|
||||
$pointer["color"] = "light_purple";
|
||||
$pointer->color = "light_purple";
|
||||
$color = "light_purple";
|
||||
break;
|
||||
case TextFormat::YELLOW:
|
||||
$pointer["color"] = "yellow";
|
||||
$pointer->color = "yellow";
|
||||
$color = "yellow";
|
||||
break;
|
||||
case TextFormat::WHITE:
|
||||
$pointer["color"] = "white";
|
||||
$pointer->color = "white";
|
||||
$color = "white";
|
||||
break;
|
||||
default:
|
||||
$pointer["text"] = $token;
|
||||
$pointer->text = $token;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($newString["extra"])){
|
||||
foreach($newString["extra"] as $k => $d){
|
||||
if(!isset($d["text"])){
|
||||
unset($newString["extra"][$k]);
|
||||
if($newString->extra !== null){
|
||||
foreach($newString->extra as $k => $d){
|
||||
if($d->text === null){
|
||||
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