Removing "metadata": overengineered useless Bukkit copy-pasta

the intentions of this are good, but the usability is terrible and it's not fit for purpose. Since there are a total of zero plugins on Poggit which use this garbage, it makes more sense to eliminate the technical debt. See #2766 for discussion about replacing this.
This commit is contained in:
Dylan K. Taylor 2019-06-26 14:43:21 +01:00
parent 26178b4435
commit ee72680f44
13 changed files with 4 additions and 601 deletions

View File

@ -46,9 +46,6 @@ use pocketmine\item\ItemFactory;
use pocketmine\lang\Language;
use pocketmine\lang\LanguageNotFoundException;
use pocketmine\lang\TextContainer;
use pocketmine\metadata\EntityMetadataStore;
use pocketmine\metadata\PlayerMetadataStore;
use pocketmine\metadata\WorldMetadataStore;
use pocketmine\nbt\BigEndianNbtSerializer;
use pocketmine\nbt\NbtDataException;
use pocketmine\nbt\tag\CompoundTag;
@ -246,15 +243,6 @@ class Server{
/** @var bool */
private $onlineMode = true;
/** @var EntityMetadataStore */
private $entityMetadata;
/** @var PlayerMetadataStore */
private $playerMetadata;
/** @var WorldMetadataStore */
private $worldMetadata;
/** @var Network */
private $network;
/** @var bool */
@ -477,27 +465,6 @@ class Server{
return $this->logger;
}
/**
* @return EntityMetadataStore
*/
public function getEntityMetadata(){
return $this->entityMetadata;
}
/**
* @return PlayerMetadataStore
*/
public function getPlayerMetadata(){
return $this->playerMetadata;
}
/**
* @return WorldMetadataStore
*/
public function getWorldMetadata(){
return $this->worldMetadata;
}
/**
* @return AutoUpdater
*/
@ -1138,10 +1105,6 @@ class Server{
$this->doTitleTick = ((bool) $this->getProperty("console.title-tick", true)) && Terminal::hasFormattingCodes();
$this->entityMetadata = new EntityMetadataStore();
$this->playerMetadata = new PlayerMetadataStore();
$this->worldMetadata = new WorldMetadataStore();
$this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM);
$this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM);
if(file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")){

View File

@ -38,12 +38,9 @@ use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use pocketmine\math\RayTraceResult;
use pocketmine\math\Vector3;
use pocketmine\metadata\Metadatable;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\types\RuntimeBlockMapping;
use pocketmine\player\Player;
use pocketmine\plugin\Plugin;
use pocketmine\world\BlockTransaction;
use pocketmine\world\Position;
use pocketmine\world\World;
@ -52,7 +49,7 @@ use function assert;
use function dechex;
use const PHP_INT_MAX;
class Block extends Position implements BlockLegacyIds, Metadatable{
class Block extends Position implements BlockLegacyIds{
/**
* Returns a new Block instance with the specified ID, meta and position.
@ -752,32 +749,4 @@ class Block extends Position implements BlockLegacyIds, Metadatable{
return $currentHit;
}
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue) : void{
if($this->isValid()){
$this->world->getBlockMetadata()->setMetadata($this, $metadataKey, $newMetadataValue);
}
}
public function getMetadata(string $metadataKey){
if($this->isValid()){
return $this->world->getBlockMetadata()->getMetadata($this, $metadataKey);
}
return null;
}
public function hasMetadata(string $metadataKey) : bool{
if($this->isValid()){
return $this->world->getBlockMetadata()->hasMetadata($this, $metadataKey);
}
return false;
}
public function removeMetadata(string $metadataKey, Plugin $owningPlugin) : void{
if($this->isValid()){
$this->world->getBlockMetadata()->removeMetadata($this, $metadataKey, $owningPlugin);
}
}
}

View File

@ -39,8 +39,6 @@ use pocketmine\math\Bearing;
use pocketmine\math\Facing;
use pocketmine\math\Vector2;
use pocketmine\math\Vector3;
use pocketmine\metadata\Metadatable;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\DoubleTag;
use pocketmine\nbt\tag\FloatTag;
@ -58,7 +56,6 @@ use pocketmine\network\mcpe\protocol\types\EntityMetadataFlags;
use pocketmine\network\mcpe\protocol\types\EntityMetadataProperties;
use pocketmine\network\mcpe\protocol\types\EntityMetadataTypes;
use pocketmine\player\Player;
use pocketmine\plugin\Plugin;
use pocketmine\Server;
use pocketmine\timings\Timings;
use pocketmine\timings\TimingsHandler;
@ -81,7 +78,7 @@ use function sin;
use function spl_object_id;
use const M_PI_2;
abstract class Entity extends Location implements Metadatable, EntityIds{
abstract class Entity extends Location implements EntityIds{
public const MOTION_THRESHOLD = 0.00001;
@ -1798,22 +1795,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
$this->close();
}
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->server->getEntityMetadata()->setMetadata($this, $metadataKey, $newMetadataValue);
}
public function getMetadata(string $metadataKey){
return $this->server->getEntityMetadata()->getMetadata($this, $metadataKey);
}
public function hasMetadata(string $metadataKey) : bool{
return $this->server->getEntityMetadata()->hasMetadata($this, $metadataKey);
}
public function removeMetadata(string $metadataKey, Plugin $owningPlugin) : void{
$this->server->getEntityMetadata()->removeMetadata($this, $metadataKey, $owningPlugin);
}
public function __toString(){
return (new \ReflectionClass($this))->getShortName() . "(" . $this->getId() . ")";
}

View File

@ -1,60 +0,0 @@
<?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\metadata;
use pocketmine\block\Block;
use pocketmine\plugin\Plugin;
use pocketmine\world\World;
class BlockMetadataStore extends MetadataStore{
/** @var World */
private $owningLevel;
public function __construct(World $owningLevel){
$this->owningLevel = $owningLevel;
}
private function disambiguate(Block $block, string $metadataKey) : string{
if($block->getWorld() !== $this->owningLevel){
throw new \InvalidStateException("Block does not belong to world " . $this->owningLevel->getDisplayName());
}
return $block->x . ":" . $block->y . ":" . $block->z . ":" . $metadataKey;
}
public function getMetadata(Block $subject, string $metadataKey){
return $this->getMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function hasMetadata(Block $subject, string $metadataKey) : bool{
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function removeMetadata(Block $subject, string $metadataKey, Plugin $owningPlugin) : void{
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
}
public function setMetadata(Block $subject, string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
}
}

View File

@ -1,50 +0,0 @@
<?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\metadata;
use pocketmine\entity\Entity;
use pocketmine\plugin\Plugin;
class EntityMetadataStore extends MetadataStore{
private function disambiguate(Entity $entity, string $metadataKey) : string{
return $entity->getId() . ":" . $metadataKey;
}
public function getMetadata(Entity $subject, string $metadataKey){
return $this->getMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function hasMetadata(Entity $subject, string $metadataKey) : bool{
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function removeMetadata(Entity $subject, string $metadataKey, Plugin $owningPlugin) : void{
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
}
public function setMetadata(Entity $subject, string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
}
}

View File

@ -1,110 +0,0 @@
<?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);
/**
* Saves extra data on runtime for different items
*/
namespace pocketmine\metadata;
use pocketmine\plugin\Plugin;
abstract class MetadataStore{
/** @var \SplObjectStorage[] */
private $metadataMap;
/**
* Adds a metadata value to an object.
*
* @param string $key
* @param MetadataValue $newMetadataValue
*/
protected function setMetadataInternal(string $key, MetadataValue $newMetadataValue) : void{
$owningPlugin = $newMetadataValue->getOwningPlugin();
if(!isset($this->metadataMap[$key])){
$entry = new \SplObjectStorage();
$this->metadataMap[$key] = $entry;
}else{
$entry = $this->metadataMap[$key];
}
$entry[$owningPlugin] = $newMetadataValue;
}
/**
* Returns all metadata values attached to an object. If multiple
* have attached metadata, each will value will be included.
*
* @param string $key
*
* @return MetadataValue[]
*/
protected function getMetadataInternal(string $key){
if(isset($this->metadataMap[$key])){
return $this->metadataMap[$key];
}else{
return [];
}
}
/**
* Tests to see if a metadata attribute has been set on an object.
*
* @param string $key
*
* @return bool
*/
protected function hasMetadataInternal(string $key) : bool{
return isset($this->metadataMap[$key]);
}
/**
* Removes a metadata item owned by a plugin from a subject.
*
* @param string $key
* @param Plugin $owningPlugin
*/
protected function removeMetadataInternal(string $key, Plugin $owningPlugin) : void{
if(isset($this->metadataMap[$key])){
unset($this->metadataMap[$key][$owningPlugin]);
if($this->metadataMap[$key]->count() === 0){
unset($this->metadataMap[$key]);
}
}
}
/**
* Invalidates all metadata in the metadata store that originates from the
* given plugin. Doing this will force each invalidated metadata item to
* be recalculated the next time it is accessed.
*
* @param Plugin $owningPlugin
*/
public function invalidateAll(Plugin $owningPlugin) : void{
/** @var MetadataValue[] $values */
foreach($this->metadataMap as $values){
if(isset($values[$owningPlugin])){
$values[$owningPlugin]->invalidate();
}
}
}
}

View File

@ -1,55 +0,0 @@
<?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\metadata;
use pocketmine\plugin\Plugin;
abstract class MetadataValue{
/** @var Plugin */
private $owningPlugin;
protected function __construct(Plugin $owningPlugin){
$this->owningPlugin = $owningPlugin;
}
/**
* @return Plugin
*/
public function getOwningPlugin() : Plugin{
return $this->owningPlugin;
}
/**
* Fetches the value of this metadata item.
*
* @return mixed
*/
abstract public function value();
/**
* Invalidates this metadata item, forcing it to recompute when next
* accessed.
*/
abstract public function invalidate() : void;
}

View File

@ -1,67 +0,0 @@
<?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\metadata;
use pocketmine\plugin\Plugin;
interface Metadatable{
/**
* Sets a metadata value in the implementing object's metadata store.
*
* @param string $metadataKey
* @param MetadataValue $newMetadataValue
*/
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue) : void;
/**
* Returns a list of previously set metadata values from the implementing
* object's metadata store.
*
* @param string $metadataKey
*
* @return MetadataValue[]
*/
public function getMetadata(string $metadataKey);
/**
* Tests to see whether the implementing object contains the given
* metadata value in its metadata store.
*
* @param string $metadataKey
*
* @return bool
*/
public function hasMetadata(string $metadataKey) : bool;
/**
* Removes the given metadata value from the implementing object's
* metadata store.
*
* @param string $metadataKey
* @param Plugin $owningPlugin
*/
public function removeMetadata(string $metadataKey, Plugin $owningPlugin) : void;
}

View File

@ -1,51 +0,0 @@
<?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\metadata;
use pocketmine\player\IPlayer;
use pocketmine\plugin\Plugin;
use function strtolower;
class PlayerMetadataStore extends MetadataStore{
private function disambiguate(IPlayer $player, string $metadataKey) : string{
return strtolower($player->getName()) . ":" . $metadataKey;
}
public function getMetadata(IPlayer $subject, string $metadataKey){
return $this->getMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function hasMetadata(IPlayer $subject, string $metadataKey) : bool{
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function removeMetadata(IPlayer $subject, string $metadataKey, Plugin $owningPlugin) : void{
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
}
public function setMetadata(IPlayer $subject, string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
}
}

View File

@ -1,51 +0,0 @@
<?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\metadata;
use pocketmine\plugin\Plugin;
use pocketmine\world\World;
use function strtolower;
class WorldMetadataStore extends MetadataStore{
private function disambiguate(World $world, string $metadataKey) : string{
return strtolower($world->getFolderName()) . ":" . $metadataKey;
}
public function getMetadata(World $subject, string $metadataKey){
return $this->getMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function hasMetadata(World $subject, string $metadataKey) : bool{
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function removeMetadata(World $subject, string $metadataKey, Plugin $owningPlugin) : void{
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
}
public function setMetadata(World $subject, string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
}
}

View File

@ -23,14 +23,11 @@ declare(strict_types=1);
namespace pocketmine\player;
use pocketmine\metadata\Metadatable;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\LongTag;
use pocketmine\plugin\Plugin;
use pocketmine\Server;
class OfflinePlayer implements IPlayer, Metadatable{
class OfflinePlayer implements IPlayer{
/** @var string */
private $name;
@ -116,20 +113,4 @@ class OfflinePlayer implements IPlayer, Metadatable{
public function hasPlayedBefore() : bool{
return $this->namedtag !== null;
}
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->server->getPlayerMetadata()->setMetadata($this, $metadataKey, $newMetadataValue);
}
public function getMetadata(string $metadataKey){
return $this->server->getPlayerMetadata()->getMetadata($this, $metadataKey);
}
public function hasMetadata(string $metadataKey) : bool{
return $this->server->getPlayerMetadata()->hasMetadata($this, $metadataKey);
}
public function removeMetadata(string $metadataKey, Plugin $owningPlugin) : void{
$this->server->getPlayerMetadata()->removeMetadata($this, $metadataKey, $owningPlugin);
}
}

View File

@ -80,7 +80,6 @@ use pocketmine\item\ItemUseResult;
use pocketmine\lang\TextContainer;
use pocketmine\lang\TranslationContainer;
use pocketmine\math\Vector3;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\DoubleTag;
@ -98,7 +97,6 @@ use pocketmine\network\mcpe\protocol\types\PlayerMetadataFlags;
use pocketmine\permission\PermissibleBase;
use pocketmine\permission\PermissibleDelegateTrait;
use pocketmine\permission\PermissionManager;
use pocketmine\plugin\Plugin;
use pocketmine\Server;
use pocketmine\timings\Timings;
use pocketmine\utils\TextFormat;
@ -2677,22 +2675,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
$this->permanentWindows = [];
}
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->server->getPlayerMetadata()->setMetadata($this, $metadataKey, $newMetadataValue);
}
public function getMetadata(string $metadataKey){
return $this->server->getPlayerMetadata()->getMetadata($this, $metadataKey);
}
public function hasMetadata(string $metadataKey) : bool{
return $this->server->getPlayerMetadata()->hasMetadata($this, $metadataKey);
}
public function removeMetadata(string $metadataKey, Plugin $owningPlugin) : void{
$this->server->getPlayerMetadata()->removeMetadata($this, $metadataKey, $owningPlugin);
}
use ChunkListenerNoOpTrait {
onChunkChanged as private;
}

View File

@ -51,9 +51,6 @@ use pocketmine\item\ItemFactory;
use pocketmine\item\ItemUseResult;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\metadata\BlockMetadataStore;
use pocketmine\metadata\Metadatable;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
@ -64,7 +61,6 @@ use pocketmine\network\mcpe\protocol\SetTimePacket;
use pocketmine\network\mcpe\protocol\types\RuntimeBlockMapping;
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
use pocketmine\player\Player;
use pocketmine\plugin\Plugin;
use pocketmine\Server;
use pocketmine\timings\Timings;
use pocketmine\utils\ReversePriorityQueue;
@ -115,7 +111,7 @@ use const PHP_INT_MIN;
#include <rules/World.h>
class World implements ChunkManager, Metadatable{
class World implements ChunkManager{
private static $worldIdCounter = 1;
@ -227,9 +223,6 @@ class World implements ChunkManager, Metadatable{
/** @var bool */
private $autoSave = true;
/** @var BlockMetadataStore */
private $blockMetadata;
/** @var Position */
private $temporalPosition;
/** @var Vector3 */
@ -349,7 +342,6 @@ class World implements ChunkManager, Metadatable{
*/
public function __construct(Server $server, string $name, WritableWorldProvider $provider){
$this->worldId = static::$worldIdCounter++;
$this->blockMetadata = new BlockMetadataStore($this);
$this->server = $server;
$this->provider = $provider;
@ -416,10 +408,6 @@ class World implements ChunkManager, Metadatable{
$this->generatorRegisteredWorkers = [];
}
public function getBlockMetadata() : BlockMetadataStore{
return $this->blockMetadata;
}
public function getServer() : Server{
return $this->server;
}
@ -461,7 +449,6 @@ class World implements ChunkManager, Metadatable{
$this->provider->close();
$this->provider = null;
$this->blockMetadata = null;
$this->blockCache = [];
$this->temporalPosition = null;
@ -2857,20 +2844,4 @@ class World implements ChunkManager, Metadatable{
}
}
}
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->server->getWorldMetadata()->setMetadata($this, $metadataKey, $newMetadataValue);
}
public function getMetadata(string $metadataKey){
return $this->server->getWorldMetadata()->getMetadata($this, $metadataKey);
}
public function hasMetadata(string $metadataKey) : bool{
return $this->server->getWorldMetadata()->hasMetadata($this, $metadataKey);
}
public function removeMetadata(string $metadataKey, Plugin $owningPlugin) : void{
$this->server->getWorldMetadata()->removeMetadata($this, $metadataKey, $owningPlugin);
}
}