mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-26 05:14:05 +00:00
metadata: populate missing return type information
This commit is contained in:
parent
36cde9f352
commit
e419d76367
@ -42,6 +42,12 @@ class BlockMetadataStore extends MetadataStore{
|
||||
return $block->x . ":" . $block->y . ":" . $block->z . ":" . $metadataKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Block $subject
|
||||
* @param string $metadataKey
|
||||
*
|
||||
* @return MetadataValue[]
|
||||
*/
|
||||
public function getMetadata(Block $subject, string $metadataKey){
|
||||
return $this->getMetadataInternal($this->disambiguate($subject, $metadataKey));
|
||||
}
|
||||
@ -50,10 +56,24 @@ class BlockMetadataStore extends MetadataStore{
|
||||
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Block $subject
|
||||
* @param string $metadataKey
|
||||
* @param Plugin $owningPlugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeMetadata(Block $subject, string $metadataKey, Plugin $owningPlugin){
|
||||
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Block $subject
|
||||
* @param string $metadataKey
|
||||
* @param MetadataValue $newMetadataValue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(Block $subject, string $metadataKey, MetadataValue $newMetadataValue){
|
||||
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
|
||||
}
|
||||
|
@ -32,6 +32,12 @@ class EntityMetadataStore extends MetadataStore{
|
||||
return $entity->getId() . ":" . $metadataKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entity $subject
|
||||
* @param string $metadataKey
|
||||
*
|
||||
* @return MetadataValue[]
|
||||
*/
|
||||
public function getMetadata(Entity $subject, string $metadataKey){
|
||||
return $this->getMetadataInternal($this->disambiguate($subject, $metadataKey));
|
||||
}
|
||||
@ -40,10 +46,24 @@ class EntityMetadataStore extends MetadataStore{
|
||||
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entity $subject
|
||||
* @param string $metadataKey
|
||||
* @param Plugin $owningPlugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeMetadata(Entity $subject, string $metadataKey, Plugin $owningPlugin){
|
||||
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entity $subject
|
||||
* @param string $metadataKey
|
||||
* @param MetadataValue $newMetadataValue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(Entity $subject, string $metadataKey, MetadataValue $newMetadataValue){
|
||||
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
|
||||
}
|
||||
|
@ -33,6 +33,12 @@ class LevelMetadataStore extends MetadataStore{
|
||||
return strtolower($level->getName()) . ":" . $metadataKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Level $subject
|
||||
* @param string $metadataKey
|
||||
*
|
||||
* @return MetadataValue[]
|
||||
*/
|
||||
public function getMetadata(Level $subject, string $metadataKey){
|
||||
return $this->getMetadataInternal($this->disambiguate($subject, $metadataKey));
|
||||
}
|
||||
@ -41,10 +47,24 @@ class LevelMetadataStore extends MetadataStore{
|
||||
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Level $subject
|
||||
* @param string $metadataKey
|
||||
* @param Plugin $owningPlugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeMetadata(Level $subject, string $metadataKey, Plugin $owningPlugin){
|
||||
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Level $subject
|
||||
* @param string $metadataKey
|
||||
* @param MetadataValue $newMetadataValue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(Level $subject, string $metadataKey, MetadataValue $newMetadataValue){
|
||||
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ abstract class MetadataStore{
|
||||
*
|
||||
* @param string $key
|
||||
* @param MetadataValue $newMetadataValue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setMetadataInternal(string $key, MetadataValue $newMetadataValue){
|
||||
$owningPlugin = $newMetadataValue->getOwningPlugin();
|
||||
@ -82,6 +84,8 @@ abstract class MetadataStore{
|
||||
*
|
||||
* @param string $key
|
||||
* @param Plugin $owningPlugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function removeMetadataInternal(string $key, Plugin $owningPlugin){
|
||||
if(isset($this->metadataMap[$key])){
|
||||
@ -98,6 +102,8 @@ abstract class MetadataStore{
|
||||
* be recalculated the next time it is accessed.
|
||||
*
|
||||
* @param Plugin $owningPlugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function invalidateAll(Plugin $owningPlugin){
|
||||
/** @var \SplObjectStorage|MetadataValue[] $values */
|
||||
|
@ -50,6 +50,8 @@ abstract class MetadataValue{
|
||||
/**
|
||||
* Invalidates this metadata item, forcing it to recompute when next
|
||||
* accessed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function invalidate();
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ interface Metadatable{
|
||||
*
|
||||
* @param string $metadataKey
|
||||
* @param MetadataValue $newMetadataValue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue);
|
||||
|
||||
@ -61,6 +63,8 @@ interface Metadatable{
|
||||
*
|
||||
* @param string $metadataKey
|
||||
* @param Plugin $owningPlugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeMetadata(string $metadataKey, Plugin $owningPlugin);
|
||||
|
||||
|
@ -33,6 +33,12 @@ class PlayerMetadataStore extends MetadataStore{
|
||||
return strtolower($player->getName()) . ":" . $metadataKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IPlayer $subject
|
||||
* @param string $metadataKey
|
||||
*
|
||||
* @return MetadataValue[]
|
||||
*/
|
||||
public function getMetadata(IPlayer $subject, string $metadataKey){
|
||||
return $this->getMetadataInternal($this->disambiguate($subject, $metadataKey));
|
||||
}
|
||||
@ -41,10 +47,24 @@ class PlayerMetadataStore extends MetadataStore{
|
||||
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IPlayer $subject
|
||||
* @param string $metadataKey
|
||||
* @param Plugin $owningPlugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeMetadata(IPlayer $subject, string $metadataKey, Plugin $owningPlugin){
|
||||
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IPlayer $subject
|
||||
* @param string $metadataKey
|
||||
* @param MetadataValue $newMetadataValue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(IPlayer $subject, string $metadataKey, MetadataValue $newMetadataValue){
|
||||
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user