Merge branch 'next-minor' into next-major

This commit is contained in:
Dylan K. Taylor 2022-11-25 14:52:56 +00:00
commit b6982a84ef
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
21 changed files with 280 additions and 49 deletions

@ -1 +1 @@
Subproject commit 14ed8eaadd921407c87be4964a8726b22427e80e Subproject commit 9353116fa8c78ed4f588b983088cabd96885286e

View File

@ -37,13 +37,13 @@
"pocketmine/bedrock-block-upgrade-schema": "dev-master@dev", "pocketmine/bedrock-block-upgrade-schema": "dev-master@dev",
"pocketmine/bedrock-data": "dev-modern-world-support@dev", "pocketmine/bedrock-data": "dev-modern-world-support@dev",
"pocketmine/bedrock-item-upgrade-schema": "dev-master", "pocketmine/bedrock-item-upgrade-schema": "dev-master",
"pocketmine/bedrock-protocol": "~14.0.0+bedrock-1.19.40", "pocketmine/bedrock-protocol": "~16.0.0+bedrock-1.19.40",
"pocketmine/binaryutils": "^0.2.1", "pocketmine/binaryutils": "^0.2.1",
"pocketmine/callback-validator": "^1.0.2", "pocketmine/callback-validator": "^1.0.2",
"pocketmine/classloader": "^0.2.0", "pocketmine/classloader": "^0.2.0",
"pocketmine/color": "^0.2.0", "pocketmine/color": "^0.2.0",
"pocketmine/errorhandler": "^0.6.0", "pocketmine/errorhandler": "^0.6.0",
"pocketmine/locale-data": "~2.9.0", "pocketmine/locale-data": "~2.10.0",
"pocketmine/log": "^0.4.0", "pocketmine/log": "^0.4.0",
"pocketmine/log-pthreads": "^0.4.0", "pocketmine/log-pthreads": "^0.4.0",
"pocketmine/math": "^0.4.0", "pocketmine/math": "^0.4.0",
@ -55,7 +55,7 @@
"symfony/filesystem": "^5.4" "symfony/filesystem": "^5.4"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "1.9.1", "phpstan/phpstan": "1.9.2",
"phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.2.0", "phpstan/phpstan-strict-rules": "^1.2.0",
"phpunit/phpunit": "^9.2" "phpunit/phpunit": "^9.2"

40
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "6bcf382aecdbb6f170fd825727b4d621", "content-hash": "abed149b2fde59580fceb9513fd35c04",
"packages": [ "packages": [
{ {
"name": "adhocore/json-comment", "name": "adhocore/json-comment",
@ -329,16 +329,16 @@
}, },
{ {
"name": "pocketmine/bedrock-protocol", "name": "pocketmine/bedrock-protocol",
"version": "14.0.0+bedrock-1.19.40", "version": "16.0.0+bedrock-1.19.40",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/BedrockProtocol.git", "url": "https://github.com/pmmp/BedrockProtocol.git",
"reference": "b455a742779fee94d25f931cc2cbf6b2c5d61c1f" "reference": "ce900ffa6a4cc07af92686f27d580dd2e2541382"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/b455a742779fee94d25f931cc2cbf6b2c5d61c1f", "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/ce900ffa6a4cc07af92686f27d580dd2e2541382",
"reference": "b455a742779fee94d25f931cc2cbf6b2c5d61c1f", "reference": "ce900ffa6a4cc07af92686f27d580dd2e2541382",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -352,7 +352,7 @@
"ramsey/uuid": "^4.1" "ramsey/uuid": "^4.1"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "1.8.8", "phpstan/phpstan": "1.9.0",
"phpstan/phpstan-phpunit": "^1.0.0", "phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.0.0", "phpstan/phpstan-strict-rules": "^1.0.0",
"phpunit/phpunit": "^9.5" "phpunit/phpunit": "^9.5"
@ -370,9 +370,9 @@
"description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP", "description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP",
"support": { "support": {
"issues": "https://github.com/pmmp/BedrockProtocol/issues", "issues": "https://github.com/pmmp/BedrockProtocol/issues",
"source": "https://github.com/pmmp/BedrockProtocol/tree/bedrock-1.19.40" "source": "https://github.com/pmmp/BedrockProtocol/tree/16.0.0+bedrock-1.19.40"
}, },
"time": "2022-10-25T21:51:46+00:00" "time": "2022-11-19T16:11:48+00:00"
}, },
{ {
"name": "pocketmine/binaryutils", "name": "pocketmine/binaryutils",
@ -590,16 +590,16 @@
}, },
{ {
"name": "pocketmine/locale-data", "name": "pocketmine/locale-data",
"version": "2.9.3", "version": "2.10.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/Language.git", "url": "https://github.com/pmmp/Language.git",
"reference": "73db4397b4150b29819bf39cc371924cc2e3f502" "reference": "d641577c8b15d9e60750dd681c0d684b89ae55e1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/Language/zipball/73db4397b4150b29819bf39cc371924cc2e3f502", "url": "https://api.github.com/repos/pmmp/Language/zipball/d641577c8b15d9e60750dd681c0d684b89ae55e1",
"reference": "73db4397b4150b29819bf39cc371924cc2e3f502", "reference": "d641577c8b15d9e60750dd681c0d684b89ae55e1",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -607,9 +607,9 @@
"description": "Language resources used by PocketMine-MP", "description": "Language resources used by PocketMine-MP",
"support": { "support": {
"issues": "https://github.com/pmmp/Language/issues", "issues": "https://github.com/pmmp/Language/issues",
"source": "https://github.com/pmmp/Language/tree/2.9.3" "source": "https://github.com/pmmp/Language/tree/2.10.3"
}, },
"time": "2022-11-12T13:59:25+00:00" "time": "2022-11-25T14:21:36+00:00"
}, },
{ {
"name": "pocketmine/log", "name": "pocketmine/log",
@ -1765,16 +1765,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.9.1", "version": "1.9.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f" "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d6fdf01c53978b6429f1393ba4afeca39cc68afa",
"reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1804,7 +1804,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.9.1" "source": "https://github.com/phpstan/phpstan/tree/1.9.2"
}, },
"funding": [ "funding": [
{ {
@ -1820,7 +1820,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-11-04T13:35:59+00:00" "time": "2022-11-10T09:56:11+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",

View File

@ -26,6 +26,7 @@ namespace pocketmine\block;
use pocketmine\block\utils\CoralType; use pocketmine\block\utils\CoralType;
use pocketmine\block\utils\CoralTypeTrait; use pocketmine\block\utils\CoralTypeTrait;
use pocketmine\block\utils\SupportType; use pocketmine\block\utils\SupportType;
use pocketmine\event\block\BlockDeathEvent;
use pocketmine\item\Item; use pocketmine\item\Item;
use function mt_rand; use function mt_rand;
@ -45,7 +46,11 @@ abstract class BaseCoral extends Transparent{
public function onScheduledUpdate() : void{ public function onScheduledUpdate() : void{
if(!$this->dead && !$this->isCoveredWithWater()){ if(!$this->dead && !$this->isCoveredWithWater()){
$this->position->getWorld()->setBlock($this->position, $this->setDead(true)); $ev = new BlockDeathEvent($this, $this->setDead(true));
$ev->call();
if(!$ev->isCancelled()){
$this->position->getWorld()->setBlock($this->position, $ev->getNewState());
}
} }
} }

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\utils\CoralType; use pocketmine\block\utils\CoralType;
use pocketmine\block\utils\CoralTypeTrait; use pocketmine\block\utils\CoralTypeTrait;
use pocketmine\event\block\BlockDeathEvent;
use pocketmine\item\Item; use pocketmine\item\Item;
use function mt_rand; use function mt_rand;
@ -54,7 +55,11 @@ final class CoralBlock extends Opaque{
} }
} }
if(!$hasWater){ if(!$hasWater){
$world->setBlock($this->position, $this->setDead(true)); $ev = new BlockDeathEvent($this, $this->setDead(true));
$ev->call();
if(!$ev->isCancelled()){
$world->setBlock($this->position, $ev->getNewState());
}
} }
} }
} }

View File

@ -32,6 +32,9 @@ use pocketmine\math\Facing;
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
use pocketmine\player\Player; use pocketmine\player\Player;
use pocketmine\world\BlockTransaction; use pocketmine\world\BlockTransaction;
use pocketmine\world\sound\ItemFrameAddItemSound;
use pocketmine\world\sound\ItemFrameRemoveItemSound;
use pocketmine\world\sound\ItemFrameRotateItemSound;
use function is_infinite; use function is_infinite;
use function is_nan; use function is_nan;
use function lcg_value; use function lcg_value;
@ -149,8 +152,12 @@ class ItemFrame extends Flowable{
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{ public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
if($this->framedItem !== null){ if($this->framedItem !== null){
$this->itemRotation = ($this->itemRotation + 1) % self::ROTATIONS; $this->itemRotation = ($this->itemRotation + 1) % self::ROTATIONS;
$this->position->getWorld()->addSound($this->position, new ItemFrameRotateItemSound());
}elseif(!$item->isNull()){ }elseif(!$item->isNull()){
$this->framedItem = $item->pop(); $this->framedItem = $item->pop();
$this->position->getWorld()->addSound($this->position, new ItemFrameAddItemSound());
}else{ }else{
return true; return true;
} }
@ -167,6 +174,7 @@ class ItemFrame extends Flowable{
$world = $this->position->getWorld(); $world = $this->position->getWorld();
if(lcg_value() <= $this->itemDropChance){ if(lcg_value() <= $this->itemDropChance){
$world->dropItem($this->position->add(0.5, 0.5, 0.5), clone $this->framedItem); $world->dropItem($this->position->add(0.5, 0.5, 0.5), clone $this->framedItem);
$world->addSound($this->position, new ItemFrameRemoveItemSound());
} }
$this->setFramedItem(null); $this->setFramedItem(null);
$world->setBlock($this->position, $this); $world->setBlock($this->position, $this);

View File

@ -53,7 +53,7 @@ class FormattedCommandAlias extends Command{
string $alias, string $alias,
private array $formatStrings private array $formatStrings
){ ){
parent::__construct($alias); parent::__construct($alias, KnownTranslationFactory::pocketmine_command_userDefined_description());
} }
public function execute(CommandSender $sender, string $commandLabel, array $args){ public function execute(CommandSender $sender, string $commandLabel, array $args){

View File

@ -43,6 +43,7 @@ use function get_loaded_extensions;
use function json_encode; use function json_encode;
use function ksort; use function ksort;
use function max; use function max;
use function mb_scrub;
use function mb_strtoupper; use function mb_strtoupper;
use function microtime; use function microtime;
use function ob_end_clean; use function ob_end_clean;
@ -196,12 +197,14 @@ class CrashDump{
$error["message"] = substr($error["message"], 0, $pos); $error["message"] = substr($error["message"], 0, $pos);
} }
} }
$error["message"] = mb_scrub($error["message"], 'UTF-8');
if(isset($lastError)){ if(isset($lastError)){
if(isset($lastError["trace"])){ if(isset($lastError["trace"])){
$lastError["trace"] = Utils::printableTrace($lastError["trace"]); $lastError["trace"] = Utils::printableTrace($lastError["trace"]);
} }
$this->data->lastError = $lastError; $this->data->lastError = $lastError;
$this->data->lastError["message"] = mb_scrub($this->data->lastError["message"], 'UTF-8');
} }
$this->data->error = $error; $this->data->error = $error;

View File

@ -0,0 +1,32 @@
<?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\event\block;
/**
* Called when a block dies.
* This could be things like corals dying due to no water being nearby.
*/
class BlockDeathEvent extends BaseBlockChangeEvent{
}

View File

@ -23,11 +23,9 @@ declare(strict_types=1);
namespace pocketmine\event\block; namespace pocketmine\event\block;
use pocketmine\event\Cancellable;
/** /**
* Called when plants or crops grow. * Called when plants or crops grow.
*/ */
class BlockGrowEvent extends BaseBlockChangeEvent implements Cancellable{ class BlockGrowEvent extends BaseBlockChangeEvent{
} }

View File

@ -26,6 +26,7 @@ namespace pocketmine\event\player;
use pocketmine\command\CommandSender; use pocketmine\command\CommandSender;
use pocketmine\event\Cancellable; use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait; use pocketmine\event\CancellableTrait;
use pocketmine\lang\KnownTranslationKeys;
use pocketmine\player\Player; use pocketmine\player\Player;
use pocketmine\utils\Utils; use pocketmine\utils\Utils;
@ -42,7 +43,7 @@ class PlayerChatEvent extends PlayerEvent implements Cancellable{
Player $player, Player $player,
protected string $message, protected string $message,
protected array $recipients, protected array $recipients,
protected string $format = "chat.type.text" protected string $format = KnownTranslationKeys::CHAT_TYPE_TEXT
){ ){
$this->player = $player; $this->player = $player;
} }

View File

@ -30,7 +30,20 @@ use pocketmine\utils\Utils;
use function is_a; use function is_a;
/** /**
* Allows the creation of players overriding the base Player class * Allows the use of custom Player classes. This enables overriding built-in Player methods to change behaviour that is
* not possible to alter any other way.
*
* You probably don't need this event, and found your way here because you looked at some code in an old plugin that
* abused it (very common). Instead of using custom player classes, you should consider making session classes instead.
*
* @see https://github.com/pmmp/SessionsDemo
*
* This event is a power-user feature, and multiple plugins using it at the same time will conflict and break unless
* they've been designed to work together. This means that it's only usually useful in private plugins.
*
* WARNING: This should NOT be used for adding extra functions or properties. This is intended for **overriding existing
* core behaviour**, and should only be used if you know EXACTLY what you're doing.
* Custom player classes may break in any update without warning. This event isn't much more than glorified reflection.
*/ */
class PlayerCreationEvent extends Event{ class PlayerCreationEvent extends Event{
@ -54,6 +67,8 @@ class PlayerCreationEvent extends Event{
} }
/** /**
* Returns the base class that the final player class must extend.
*
* @phpstan-return class-string<Player> * @phpstan-return class-string<Player>
*/ */
public function getBaseClass() : string{ public function getBaseClass() : string{
@ -61,6 +76,10 @@ class PlayerCreationEvent extends Event{
} }
/** /**
* Sets the class that the final player class must extend.
* The new base class must be a subclass of the current base class.
* This can (perhaps) be used to limit the options for custom player classes provided by other plugins.
*
* @phpstan-param class-string<Player> $class * @phpstan-param class-string<Player> $class
*/ */
public function setBaseClass(string $class) : void{ public function setBaseClass(string $class) : void{
@ -72,6 +91,8 @@ class PlayerCreationEvent extends Event{
} }
/** /**
* Returns the class that will be instantiated to create the player after the event.
*
* @phpstan-return class-string<Player> * @phpstan-return class-string<Player>
*/ */
public function getPlayerClass() : string{ public function getPlayerClass() : string{
@ -79,6 +100,9 @@ class PlayerCreationEvent extends Event{
} }
/** /**
* Sets the class that will be instantiated to create the player after the event. The class must not be abstract,
* and must be an instance of the base class.
*
* @phpstan-param class-string<Player> $class * @phpstan-param class-string<Player> $class
*/ */
public function setPlayerClass(string $class) : void{ public function setPlayerClass(string $class) : void{

View File

@ -33,12 +33,25 @@ use pocketmine\utils\ObjectSet;
interface Inventory{ interface Inventory{
public const MAX_STACK = 64; public const MAX_STACK = 64;
/**
* Returns the number of slots in the inventory.
*/
public function getSize() : int; public function getSize() : int;
/**
* Returns the maximum stack size for items in this inventory. Individual item types (such as armor or tools) may
* have a smaller maximum stack size.
*/
public function getMaxStackSize() : int; public function getMaxStackSize() : int;
/**
* Sets the maximum stack size for items in this inventory.
*/
public function setMaxStackSize(int $size) : void; public function setMaxStackSize(int $size) : void;
/**
* Returns the item in the specified slot.
*/
public function getItem(int $index) : Item; public function getItem(int $index) : Item;
/** /**
@ -65,10 +78,11 @@ interface Inventory{
public function setContents(array $items) : void; public function setContents(array $items) : void;
/** /**
* Stores the given Items in the inventory. This will try to fill * Stores the given Items in the inventory.
* existing stacks and empty slots as well as it can. * This will add to any non-full existing stacks first, and then put the remaining items in empty slots if there are
* any available.
* *
* Returns the Items that did not fit. * Returns an array of items which could not fit in the inventory.
* *
* @return Item[] * @return Item[]
*/ */
@ -85,15 +99,20 @@ interface Inventory{
public function getAddableItemQuantity(Item $item) : int; public function getAddableItemQuantity(Item $item) : int;
/** /**
* Checks if the inventory contains any Item with the same material data. * Returns whether the total amount of matching items is at least the stack size of the given item. Multiple stacks
* It will check id, amount, and metadata (if not null) * of the same item are added together.
*
* If the input item has specific NBT, only items with the same type and NBT will match. Otherwise, only the item
* type is checked.
*/ */
public function contains(Item $item) : bool; public function contains(Item $item) : bool;
/** /**
* Will return all the Items that has the same id and metadata (if not null). * Returns all matching items in the inventory, irrespective of stack size. The returned array is indexed by slot
* Won't check amount * number.
* The returned array is indexed by slot number. *
* If the input item has specific NBT, only items with the same type and NBT will match. Otherwise, only the item
* type is checked.
* *
* @return Item[] * @return Item[]
* @phpstan-return array<int, Item> * @phpstan-return array<int, Item>
@ -101,10 +120,10 @@ interface Inventory{
public function all(Item $item) : array; public function all(Item $item) : array;
/** /**
* Returns the first slot number containing an item with the same ID, damage (if not any-damage), NBT (if not empty) * Returns the first slot number containing a matching item with a stack size greater than or equal to the input item.
* and count >= to the count of the specified item stack.
* *
* If $exact is true, only items with equal ID, damage, NBT and count will match. * If the input item has specific NBT, or if $exact is true, only items with the same type and NBT will match.
* Otherwise, only the item type is checked.
*/ */
public function first(Item $item, bool $exact = false) : int; public function first(Item $item, bool $exact = false) : int;
@ -119,13 +138,19 @@ interface Inventory{
public function isSlotEmpty(int $index) : bool; public function isSlotEmpty(int $index) : bool;
/** /**
* Will remove all the Items that has the same id and metadata (if not null) * Clears all slots containing items equivalent to the given item.
*
* If the input item has specific NBT, only items with the same type and NBT will match. Otherwise, only the item
* type is checked.
*/ */
public function remove(Item $item) : void; public function remove(Item $item) : void;
/** /**
* Removes the given Item from the inventory. * Removes items from the inventory in the amounts specified by the given itemstacks.
* It will return the Items that couldn't be removed. * Returns an array of items that couldn't be removed.
*
* If the input item has specific NBT, only items with the same type and NBT will match. Otherwise, only the item
* type is checked.
* *
* @return Item[] * @return Item[]
*/ */

View File

@ -863,6 +863,10 @@ final class KnownTranslationFactory{
return new Translatable(KnownTranslationKeys::ENCHANTMENT_SOUL_SPEED, []); return new Translatable(KnownTranslationKeys::ENCHANTMENT_SOUL_SPEED, []);
} }
public static function enchantment_swift_sneak() : Translatable{
return new Translatable(KnownTranslationKeys::ENCHANTMENT_SWIFT_SNEAK, []);
}
public static function enchantment_thorns() : Translatable{ public static function enchantment_thorns() : Translatable{
return new Translatable(KnownTranslationKeys::ENCHANTMENT_THORNS, []); return new Translatable(KnownTranslationKeys::ENCHANTMENT_THORNS, []);
} }
@ -954,6 +958,10 @@ final class KnownTranslationFactory{
return new Translatable(KnownTranslationKeys::ITEM_RECORD_13_DESC, []); return new Translatable(KnownTranslationKeys::ITEM_RECORD_13_DESC, []);
} }
public static function item_record_5_desc() : Translatable{
return new Translatable(KnownTranslationKeys::ITEM_RECORD_5_DESC, []);
}
public static function item_record_blocks_desc() : Translatable{ public static function item_record_blocks_desc() : Translatable{
return new Translatable(KnownTranslationKeys::ITEM_RECORD_BLOCKS_DESC, []); return new Translatable(KnownTranslationKeys::ITEM_RECORD_BLOCKS_DESC, []);
} }
@ -978,6 +986,10 @@ final class KnownTranslationFactory{
return new Translatable(KnownTranslationKeys::ITEM_RECORD_MELLOHI_DESC, []); return new Translatable(KnownTranslationKeys::ITEM_RECORD_MELLOHI_DESC, []);
} }
public static function item_record_otherside_desc() : Translatable{
return new Translatable(KnownTranslationKeys::ITEM_RECORD_OTHERSIDE_DESC, []);
}
public static function item_record_pigstep_desc() : Translatable{ public static function item_record_pigstep_desc() : Translatable{
return new Translatable(KnownTranslationKeys::ITEM_RECORD_PIGSTEP_DESC, []); return new Translatable(KnownTranslationKeys::ITEM_RECORD_PIGSTEP_DESC, []);
} }

View File

@ -190,6 +190,7 @@ final class KnownTranslationKeys{
public const ENCHANTMENT_PROTECT_FIRE = "enchantment.protect.fire"; public const ENCHANTMENT_PROTECT_FIRE = "enchantment.protect.fire";
public const ENCHANTMENT_PROTECT_PROJECTILE = "enchantment.protect.projectile"; public const ENCHANTMENT_PROTECT_PROJECTILE = "enchantment.protect.projectile";
public const ENCHANTMENT_SOUL_SPEED = "enchantment.soul_speed"; public const ENCHANTMENT_SOUL_SPEED = "enchantment.soul_speed";
public const ENCHANTMENT_SWIFT_SNEAK = "enchantment.swift_sneak";
public const ENCHANTMENT_THORNS = "enchantment.thorns"; public const ENCHANTMENT_THORNS = "enchantment.thorns";
public const ENCHANTMENT_TRIDENTCHANNELING = "enchantment.tridentChanneling"; public const ENCHANTMENT_TRIDENTCHANNELING = "enchantment.tridentChanneling";
public const ENCHANTMENT_TRIDENTIMPALING = "enchantment.tridentImpaling"; public const ENCHANTMENT_TRIDENTIMPALING = "enchantment.tridentImpaling";
@ -211,12 +212,14 @@ final class KnownTranslationKeys{
public const IP_WARNING = "ip_warning"; public const IP_WARNING = "ip_warning";
public const ITEM_RECORD_11_DESC = "item.record_11.desc"; public const ITEM_RECORD_11_DESC = "item.record_11.desc";
public const ITEM_RECORD_13_DESC = "item.record_13.desc"; public const ITEM_RECORD_13_DESC = "item.record_13.desc";
public const ITEM_RECORD_5_DESC = "item.record_5.desc";
public const ITEM_RECORD_BLOCKS_DESC = "item.record_blocks.desc"; public const ITEM_RECORD_BLOCKS_DESC = "item.record_blocks.desc";
public const ITEM_RECORD_CAT_DESC = "item.record_cat.desc"; public const ITEM_RECORD_CAT_DESC = "item.record_cat.desc";
public const ITEM_RECORD_CHIRP_DESC = "item.record_chirp.desc"; public const ITEM_RECORD_CHIRP_DESC = "item.record_chirp.desc";
public const ITEM_RECORD_FAR_DESC = "item.record_far.desc"; public const ITEM_RECORD_FAR_DESC = "item.record_far.desc";
public const ITEM_RECORD_MALL_DESC = "item.record_mall.desc"; public const ITEM_RECORD_MALL_DESC = "item.record_mall.desc";
public const ITEM_RECORD_MELLOHI_DESC = "item.record_mellohi.desc"; public const ITEM_RECORD_MELLOHI_DESC = "item.record_mellohi.desc";
public const ITEM_RECORD_OTHERSIDE_DESC = "item.record_otherside.desc";
public const ITEM_RECORD_PIGSTEP_DESC = "item.record_pigstep.desc"; public const ITEM_RECORD_PIGSTEP_DESC = "item.record_pigstep.desc";
public const ITEM_RECORD_STAL_DESC = "item.record_stal.desc"; public const ITEM_RECORD_STAL_DESC = "item.record_stal.desc";
public const ITEM_RECORD_STRAD_DESC = "item.record_strad.desc"; public const ITEM_RECORD_STRAD_DESC = "item.record_strad.desc";

View File

@ -171,6 +171,14 @@ class Language{
return $this->internalGet($id) ?? $id; return $this->internalGet($id) ?? $id;
} }
/**
* @return string[]
* @phpstan-return array<string, string>
*/
public function getAll() : array{
return $this->lang;
}
protected function parseTranslation(string $text, ?string $onlyPrefix = null) : string{ protected function parseTranslation(string $text, ?string $onlyPrefix = null) : string{
$newString = ""; $newString = "";

View File

@ -166,8 +166,10 @@ abstract class Terminal{
case Utils::OS_LINUX: case Utils::OS_LINUX:
case Utils::OS_MACOS: case Utils::OS_MACOS:
case Utils::OS_BSD: case Utils::OS_BSD:
if(getenv('TERM') !== false){
self::getEscapeCodes(); self::getEscapeCodes();
return; return;
}
case Utils::OS_WINDOWS: case Utils::OS_WINDOWS:
case Utils::OS_ANDROID: case Utils::OS_ANDROID:

View File

@ -0,0 +1,35 @@
<?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\world\sound;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\LevelEvent;
class ItemFrameAddItemSound implements Sound{
public function encode(Vector3 $pos) : array{
return [LevelEventPacket::create(LevelEvent::SOUND_ITEMFRAME_ADD_ITEM, 0, $pos)];
}
}

View File

@ -0,0 +1,35 @@
<?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\world\sound;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\LevelEvent;
class ItemFrameRemoveItemSound implements Sound{
public function encode(Vector3 $pos) : array{
return [LevelEventPacket::create(LevelEvent::SOUND_ITEMFRAME_REMOVE_ITEM, 0, $pos)];
}
}

View File

@ -0,0 +1,35 @@
<?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\world\sound;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\LevelEvent;
class ItemFrameRotateItemSound implements Sound{
public function encode(Vector3 $pos) : array{
return [LevelEventPacket::create(LevelEvent::SOUND_ITEMFRAME_ROTATE_ITEM, 0, $pos)];
}
}