mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 02:21:46 +00:00
Replace disallowed operators in src/event/
This commit is contained in:
parent
22fb02c4e6
commit
aa6bd4438a
@ -65,11 +65,11 @@ class HandlerList{
|
|||||||
* @param RegisteredListener|Listener|Plugin $object
|
* @param RegisteredListener|Listener|Plugin $object
|
||||||
*/
|
*/
|
||||||
public function unregister($object) : void{
|
public function unregister($object) : void{
|
||||||
if($object instanceof Plugin or $object instanceof Listener){
|
if($object instanceof Plugin || $object instanceof Listener){
|
||||||
foreach($this->handlerSlots as $priority => $list){
|
foreach($this->handlerSlots as $priority => $list){
|
||||||
foreach($list as $hash => $listener){
|
foreach($list as $hash => $listener){
|
||||||
if(($object instanceof Plugin and $listener->getPlugin() === $object)
|
if(($object instanceof Plugin && $listener->getPlugin() === $object)
|
||||||
or ($object instanceof Listener and (new \ReflectionFunction($listener->getHandler()))->getClosureThis() === $object) //this doesn't even need to be a listener :D
|
|| ($object instanceof Listener && (new \ReflectionFunction($listener->getHandler()))->getClosureThis() === $object) //this doesn't even need to be a listener :D
|
||||||
){
|
){
|
||||||
unset($this->handlerSlots[$priority][$hash]);
|
unset($this->handlerSlots[$priority][$hash]);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class HandlerListManager{
|
|||||||
* @param Plugin|Listener|RegisteredListener|null $object
|
* @param Plugin|Listener|RegisteredListener|null $object
|
||||||
*/
|
*/
|
||||||
public function unregisterAll($object = null) : void{
|
public function unregisterAll($object = null) : void{
|
||||||
if($object instanceof Listener or $object instanceof Plugin or $object instanceof RegisteredListener){
|
if($object instanceof Listener || $object instanceof Plugin || $object instanceof RegisteredListener){
|
||||||
foreach($this->allLists as $h){
|
foreach($this->allLists as $h){
|
||||||
$h->unregister($object);
|
$h->unregister($object);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class RegisteredListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function callEvent(Event $event) : void{
|
public function callEvent(Event $event) : void{
|
||||||
if($event instanceof Cancellable and $event->isCancelled() and !$this->isHandlingCancelled()){
|
if($event instanceof Cancellable && $event->isCancelled() && !$this->isHandlingCancelled()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->timings->startTiming();
|
$this->timings->startTiming();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user