mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
scheduler: removing task IDs
These no longer serve any purpose that can't be replaced with a structure like Ds\Set, SplObjectStorage, or just using spl_object_id().
This commit is contained in:
@ -49,9 +49,6 @@ class TaskScheduler{
|
||||
*/
|
||||
protected $tasks;
|
||||
|
||||
/** @var int */
|
||||
private $ids = 1;
|
||||
|
||||
/** @var int */
|
||||
protected $currentTick = 0;
|
||||
|
||||
@ -85,7 +82,6 @@ class TaskScheduler{
|
||||
while(!$this->queue->isEmpty()){
|
||||
$this->queue->extract();
|
||||
}
|
||||
$this->ids = 1;
|
||||
}
|
||||
|
||||
public function isQueued(TaskHandler $task) : bool{
|
||||
@ -110,7 +106,7 @@ class TaskScheduler{
|
||||
$period = 1;
|
||||
}
|
||||
|
||||
return $this->handle(new TaskHandler($task, $this->nextId(), $delay, $period, $this->owner));
|
||||
return $this->handle(new TaskHandler($task, $delay, $period, $this->owner));
|
||||
}
|
||||
|
||||
private function handle(TaskHandler $handler) : TaskHandler{
|
||||
@ -159,8 +155,4 @@ class TaskScheduler{
|
||||
private function isReady(int $currentTick) : bool{
|
||||
return !$this->queue->isEmpty() and $this->queue->current()->getNextRun() <= $currentTick;
|
||||
}
|
||||
|
||||
private function nextId() : int{
|
||||
return $this->ids++;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user