mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Improved CallbackTask timings data
This commit is contained in:
@ -45,6 +45,13 @@ class CallbackTask extends Task{
|
||||
$this->args[] = $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return callable
|
||||
*/
|
||||
public function getCallable(){
|
||||
return $this->callable;
|
||||
}
|
||||
|
||||
public function onRun($currentTicks){
|
||||
call_user_func_array($this->callable, $this->args);
|
||||
}
|
||||
|
@ -184,7 +184,18 @@ class ServerScheduler{
|
||||
$period = 1;
|
||||
}
|
||||
|
||||
return $this->handle(new TaskHandler(get_class($task), $task, $this->nextId(), $delay, $period));
|
||||
if($task instanceof CallbackTask){
|
||||
$callable = $task->getCallable();
|
||||
if(is_array($callable)){
|
||||
$taskName = "Callback#" . get_class($callable[0]) . "::" . $callable[1];
|
||||
}else{
|
||||
$taskName = "Callback#" . $callable;
|
||||
}
|
||||
}else{
|
||||
$taskName = get_class($task);
|
||||
}
|
||||
|
||||
return $this->handle(new TaskHandler($taskName, $task, $this->nextId(), $delay, $period));
|
||||
}
|
||||
|
||||
private function handle(TaskHandler $handler){
|
||||
|
Reference in New Issue
Block a user