mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Merge branch 'stable' into minor-next
This commit is contained in:
@ -33,7 +33,10 @@ use function spl_object_id;
|
||||
* The primary purpose of this trait is providing scope isolation for the methods it contains.
|
||||
*/
|
||||
trait ItemEnchantmentHandlingTrait{
|
||||
/** @var EnchantmentInstance[] */
|
||||
/**
|
||||
* @var EnchantmentInstance[]
|
||||
* @phpstan-var array<int, EnchantmentInstance>
|
||||
*/
|
||||
protected array $enchantments = [];
|
||||
|
||||
public function hasEnchantments() : bool{
|
||||
@ -79,6 +82,7 @@ trait ItemEnchantmentHandlingTrait{
|
||||
|
||||
/**
|
||||
* @return EnchantmentInstance[]
|
||||
* @phpstan-return array<int, EnchantmentInstance>
|
||||
*/
|
||||
public function getEnchantments() : array{
|
||||
return $this->enchantments;
|
||||
|
@ -29,6 +29,7 @@ use pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
use pocketmine\utils\Filesystem;
|
||||
use pocketmine\utils\SingletonTrait;
|
||||
use pocketmine\utils\Utils;
|
||||
use pocketmine\world\format\io\GlobalItemDataHandlers;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
use function explode;
|
||||
@ -67,7 +68,7 @@ final class LegacyStringToItemParser{
|
||||
$mappings = json_decode($mappingsRaw, true);
|
||||
if(!is_array($mappings)) throw new AssumptionFailedError("Invalid mappings format, expected array");
|
||||
|
||||
foreach($mappings as $name => $id){
|
||||
foreach(Utils::promoteKeys($mappings) as $name => $id){
|
||||
if(!is_string($id)) throw new AssumptionFailedError("Invalid mappings format, expected string values");
|
||||
$result->addMapping((string) $name, $id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user