Hello! I created two class : main and Task I have called Task in main class and I used this in my main class and Task class : PHP: public function onNothing() { $this->called++; if($this->called == 1) { $task = new Task($this, $player); $this->task[] = $task; $h = $this->getServer()->getScheduler()->scheduleRepeatingTask($task, 20); $task->setHandler($h); $this->task[$task->getTaskId()] = $task->getTaskId(); Task class (sub class) PHP: public function __construct(main $plugin , Player $player) { $this->plugin = $plugin; $this->player = $player; $this->seconds = 0; parent::__construct($plugin); } So I want to get $seconds to my main class As you can see I already use __construct so if I use __construct again in my main class,the server can't not find constructor I also tried $this->plugin->seconds but how do you define $this->plugin is? Anyone can help QAQ
using $this->plugin->seconds is a bad idea when you want to run concurrent events i would highly suggest looking into using &
look it up PHP and sign you can construct the task with a reference which you set it in an array somewhere
uhmm i have read that webside and I don't understand it well.... Also, i only see access variable between one class...