My code is: $par["room"] = $room; $par["num"] = 0; $this->getServer()->getScheduler()->scheduleDelayedTask(new TimerOut($par), 20); But the server crashed, showed an error: "Invalid owner of PluginTask" What is the matter, how can I fix it ?? I need help !
But i don't want to transfer the main class. i only want to transfer the $par. and it may run a few times in one second.
Every task, must have an owner, or it will become a DeadLock or whatever it called, so you must pass it's owner Code: $this->getServer()->getScheduler()->scheduleDelayedTask(new TimerOut($this, $par), 20); and in the TimerOut class Code: class TimerOut extends PluginTask{ private $plugin; private $par; public function __construct(Plugin $plugin, $par){ parent::__construct($plugin); $this->plugin = $plugin; $this->par = $par; }