diff --git a/src/Events/Event.php b/src/Events/Event.php index 3f1d81b1d..9534b8a78 100644 --- a/src/Events/Event.php +++ b/src/Events/Event.php @@ -102,7 +102,8 @@ public function delay(float $delay, callable $func, array $args = []): int { $className = $this->eventClassName; $timerId = $this->timerId++; - $event = new $className($this->eventBase, -1, $className::TIMEOUT, function () use ($func, $args) { + $event = new $className($this->eventBase, -1, $className::TIMEOUT, function () use ($func, $args, $timerId) { + unset($this->eventTimer[$timerId]); try { $func(...$args); } catch (Throwable $e) {