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:
@ -44,7 +44,7 @@ class BlockMetadataStore extends MetadataStore{
|
||||
if($block->getLevel() === $this->owningLevel){
|
||||
return parent::getMetadata($block, $metadataKey);
|
||||
}else{
|
||||
trigger_error("Block does not belong to world " . $this->owningLevel->getName());
|
||||
throw new \Exception("Block does not belong to world " . $this->owningLevel->getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ class BlockMetadataStore extends MetadataStore{
|
||||
if($block->getLevel() === $this->owningLevel){
|
||||
return parent::hasMetadata($block, $metadataKey);
|
||||
}else{
|
||||
trigger_error("Block does not belong to world " . $this->owningLevel->getName());
|
||||
throw new \Exception("Block does not belong to world " . $this->owningLevel->getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class BlockMetadataStore extends MetadataStore{
|
||||
if($block->getLevel() === $this->owningLevel){
|
||||
parent::hasMetadata($block, $metadataKey, $owningPlugin);
|
||||
}else{
|
||||
trigger_error("Block does not belong to world " . $this->owningLevel->getName());
|
||||
throw new \Exception("Block does not belong to world " . $this->owningLevel->getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ class BlockMetadataStore extends MetadataStore{
|
||||
if($block->getLevel() === $this->owningLevel){
|
||||
parent::setMetadata($block, $metadataKey, $newMetadatavalue);
|
||||
}else{
|
||||
trigger_error("Block does not belong to world " . $this->owningLevel->getName());
|
||||
throw new \Exception("Block does not belong to world " . $this->owningLevel->getName());
|
||||
}
|
||||
}
|
||||
}
|
@ -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