mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 01:39:52 +00:00
Removed a couple of useless null checks from PermissibleBase
This commit is contained in:
parent
7f09a2a26e
commit
edf1fbb6e6
@ -127,9 +127,7 @@ class PermissibleBase implements Permissible{
|
|||||||
* @throws PluginException
|
* @throws PluginException
|
||||||
*/
|
*/
|
||||||
public function addAttachment(Plugin $plugin, $name = null, $value = null){
|
public function addAttachment(Plugin $plugin, $name = null, $value = null){
|
||||||
if($plugin === null){
|
if(!$plugin->isEnabled()){
|
||||||
throw new PluginException("Plugin cannot be null");
|
|
||||||
}elseif(!$plugin->isEnabled()){
|
|
||||||
throw new PluginException("Plugin " . $plugin->getDescription()->getName() . " is disabled");
|
throw new PluginException("Plugin " . $plugin->getDescription()->getName() . " is disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,14 +144,8 @@ class PermissibleBase implements Permissible{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PermissionAttachment $attachment
|
* @param PermissionAttachment $attachment
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
*/
|
||||||
public function removeAttachment(PermissionAttachment $attachment){
|
public function removeAttachment(PermissionAttachment $attachment){
|
||||||
if($attachment === null){
|
|
||||||
throw new \InvalidStateException("Attachment cannot be null");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($this->attachments[spl_object_hash($attachment)])){
|
if(isset($this->attachments[spl_object_hash($attachment)])){
|
||||||
unset($this->attachments[spl_object_hash($attachment)]);
|
unset($this->attachments[spl_object_hash($attachment)]);
|
||||||
if(($ex = $attachment->getRemovalCallback()) !== null){
|
if(($ex = $attachment->getRemovalCallback()) !== null){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user