mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
correction of various problems
This commit is contained in:
parent
7e87fbbb7a
commit
5beaa3ce4e
@ -106,7 +106,7 @@ final class AsyncEventDelegate{
|
||||
$nonConcurrentHandlers = [];
|
||||
foreach($handlers as $registration){
|
||||
if($registration instanceof RegisteredAsyncListener){
|
||||
if($registration->canBeCallConcurrently()){
|
||||
if($registration->canBeCalledConcurrently()){
|
||||
$this->promises->add($registration->callAsync($this->event));
|
||||
}else{
|
||||
$nonConcurrentHandlers[] = $registration;
|
||||
|
@ -26,8 +26,6 @@ namespace pocketmine\event;
|
||||
use pocketmine\promise\Promise;
|
||||
|
||||
trait AsyncEventTrait {
|
||||
private AsyncEventDelegate $delegate;
|
||||
|
||||
/**
|
||||
* @phpstan-return Promise<null>
|
||||
*/
|
||||
|
@ -142,11 +142,8 @@ class HandlerList{
|
||||
}
|
||||
foreach($asyncListenersByPriority as $priority => $asyncListeners){
|
||||
usort($asyncListeners, static function(RegisteredAsyncListener $a, RegisteredAsyncListener $b) : int{
|
||||
if($a->canBeCallConcurrently()){
|
||||
return $b->canBeCallConcurrently() ? 0 : -1;
|
||||
}else{
|
||||
return $b->canBeCallConcurrently() ? -1 : 0;
|
||||
}
|
||||
// concurrent listeners are sorted to the end of the list
|
||||
return $b->canBeCalledConcurrently() <=> $a->canBeCalledConcurrently();
|
||||
});
|
||||
$listenersByPriority[$priority] = array_merge($listenersByPriority[$priority] ?? [], $asyncListeners);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class RegisteredAsyncListener extends RegisteredListener{
|
||||
parent::__construct($handler, $priority, $plugin, $handleCancelled, $timings);
|
||||
}
|
||||
|
||||
public function canBeCallConcurrently() : bool{
|
||||
public function canBeCalledConcurrently() : bool{
|
||||
return !$this->noConcurrentCall;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user