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

@ -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;
}