mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Updated trigger_error to Exceptions, fixed bug in Plugin task deletion
This commit is contained in:
@ -36,13 +36,13 @@ abstract class MetadataStore{
|
||||
* @param mixed $subject
|
||||
* @param string $metadataKey
|
||||
* @param MetadataValue $newMetadataValue
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setMetadata($subject, $metadataKey, MetadataValue $newMetadataValue){
|
||||
$owningPlugin = $newMetadataValue->getOwningPlugin();
|
||||
if($owningPlugin === null){
|
||||
trigger_error("Plugin cannot be null", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
throw new \Exception("Plugin cannot be null");
|
||||
}
|
||||
|
||||
$key = $this->disambiguate($subject, $metadataKey);
|
||||
@ -63,6 +63,8 @@ abstract class MetadataStore{
|
||||
* @param string $metadataKey
|
||||
*
|
||||
* @return MetadataValue[]
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getMetadata($subject, $metadataKey){
|
||||
$key = $this->disambiguate($subject, $metadataKey);
|
||||
@ -80,6 +82,8 @@ abstract class MetadataStore{
|
||||
* @param string $metadataKey
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function hasMetadata($subject, $metadataKey){
|
||||
return isset($this->metadataMap[$this->disambiguate($subject, $metadataKey)]);
|
||||
@ -91,6 +95,8 @@ abstract class MetadataStore{
|
||||
* @param mixed $subject
|
||||
* @param string $metadataKey
|
||||
* @param Plugin $owningPlugin
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function removeMetadata($subject, $metadataKey, Plugin $owningPlugin){
|
||||
$key = $this->disambiguate($subject, $metadataKey);
|
||||
|
Reference in New Issue
Block a user