◆ disambiguate()
Creates a unique name for the object receiving metadata by combining unique data from the subject with a metadataKey.
- Parameters
-
- Returns
- string
- Exceptions
-
◆ getMetadata()
getMetadata |
( |
|
$subject, |
|
|
|
$metadataKey |
|
) |
| |
Returns all metadata values attached to an object. If multiple have attached metadata, each will value will be included.
- Parameters
-
mixed | $subject | |
string | $metadataKey | |
- Returns
- MetadataValue[]
- Exceptions
-
73 if(isset($this->metadataMap[$key])){
74 return $this->metadataMap[$key];
◆ hasMetadata()
hasMetadata |
( |
|
$subject, |
|
|
|
$metadataKey |
|
) |
| |
Tests to see if a metadata attribute has been set on an object.
- Parameters
-
mixed | $subject | |
string | $metadataKey | |
- Returns
- bool
- Exceptions
-
91 return isset($this->metadataMap[$this->
disambiguate($subject, $metadataKey)]);
◆ removeMetadata()
removeMetadata |
( |
|
$subject, |
|
|
|
$metadataKey, |
|
|
Plugin |
$owningPlugin |
|
) |
| |
Removes a metadata item owned by a plugin from a subject.
- Parameters
-
mixed | $subject | |
string | $metadataKey | |
Plugin | $owningPlugin | |
- Exceptions
-
105 if(isset($this->metadataMap[$key])){
106 unset($this->metadataMap[$key][$owningPlugin]);
107 if($this->metadataMap[$key]->count() === 0){
108 unset($this->metadataMap[$key]);
◆ setMetadata()
setMetadata |
( |
|
$subject, |
|
|
|
$metadataKey, |
|
|
MetadataValue |
$newMetadataValue |
|
) |
| |
Adds a metadata value to an object.
- Parameters
-
- Exceptions
-
45 $owningPlugin = $newMetadataValue->getOwningPlugin();
46 if($owningPlugin === null){
47 throw new PluginException(
"Plugin cannot be null");
51 if(!isset($this->metadataMap[$key])){
53 $this->metadataMap[$key] = new \SplObjectStorage();
55 $entry = $this->metadataMap[$key];
57 $entry[$owningPlugin] = $newMetadataValue;
The documentation for this class was generated from the following file:
- src/pocketmine/metadata/MetadataStore.php