mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 08:35:20 +00:00
Properly deal with anonymous tasks in timings
This commit is contained in:
@ -23,6 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\scheduler;
|
||||
|
||||
use pocketmine\utils\Utils;
|
||||
|
||||
abstract class Task{
|
||||
|
||||
/** @var TaskHandler */
|
||||
@ -46,6 +48,10 @@ abstract class Task{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return Utils::getNiceClassName($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TaskHandler|null $taskHandler
|
||||
*/
|
||||
|
@ -66,7 +66,7 @@ class TaskHandler{
|
||||
$this->taskId = $taskId;
|
||||
$this->delay = $delay;
|
||||
$this->period = $period;
|
||||
$this->taskName = get_class($task);
|
||||
$this->taskName = $task->getName();
|
||||
$this->ownerName = $ownerName ?? "Unknown";
|
||||
$this->timings = Timings::getScheduledTaskTimings($this, $period);
|
||||
$this->task->setHandler($this);
|
||||
|
Reference in New Issue
Block a user