Hi, when i start my plugin, this happens in consol: Code: system> Enabling News v1 notice> InvalidArgumentException: "Argument 1 passed to News\shownews::__construct() must be an instance of News\Plugin, instance of News\Main given, called in /bla/bub/PocketMine/plugins/News/src/News/Main.php on line 20 and defined" (E_RECOVERABLE_ERROR) in "/News/src/News/Main" at line 42 Disabling News v1 And here is my code: Code: <?php namespace News; use pocketmine\plugin\PluginBase; use pocketmine\Server; use pocketmine\scheduler; use pocketmine\scheduler\PluginTask; use pocketmine\event; use pocketmine\event\Listener; use pocketmine\utils\TextFormat as Color; use pocketmine\event\player\PlayerChatEvent; use pocketmine\command\CommandSender; use pocketmine\command\Command; use pocketmine\Player; class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getScheduler()->scheduleRepeatingTask(new shownews($this), 20); $this->saveDefaultConfig(); $this->zeit = 0; $this->getLogger()->info(Color::GREEN . "News"); } public function onCommand(CommandSender $sender, Command $command, $label, array $args) { $cmd = strtolower($command->getName()); switch ($cmd){ case "news": if (!($sender instanceof Player)){ $sender->sendMessage($this->getConfig()->get("news1")); $sender->sendMessage($this->getConfig()->get("news2")); $sender->sendMessage($this->getConfig()->get("news3")); $sender->sendMessage($this->getConfig()->get("news4")); $sender->sendMessage($this->getConfig()->get("news5")); return true; } } } } class shownews extends PluginTask implements Listener{ public function __construct(Plugin $owner){ parent::__construct($owner); } public function onRun($currentTick){ if($this->getOwner()->zeit < 5){ foreach($this->getOwner()->getServer()->getLevelByName("spawn")->getPlayers() as $player){ $player->sendTip($this->getConfig()->get("news1")); } $this->getOwner()->zeit + 1; return true; } if($this->getowner()->zeit < 10){ foreach($this->getOwner()->getServer()->getLevelByName("spawn")->getPlayers() as $player){ $player->sendTip($this->getConfig()->get("news2")); } $this->getOwner()->zeit + 1; return true; } if($this->getowner()->zeit < 15){ foreach($this->getOwner()->getServer()->getLevelByName("spawn")->getPlayers() as $player){ $player->sendTip($this->getConfig()->get("news3")); } $this->getOwner()->zeit + 1; return true; } if($this->getowner()->zeit < 20){ foreach($this->getOwner()->getServer()->getLevelByName("spawn")->getPlayers() as $player){ $player->sendTip($this->getConfig()->get("news4")); } $this->getOwner()->zeit + 1; return true; } if($this->getowner()->zeit < 25){ foreach($this->getOwner()->getServer()->getLevelByName("spawn")->getPlayers() as $player){ $player->sendTip($this->getConfig()->get("news5")); } $this->getOwner()->zeit + 1; return true; } if($this->getOwner()->zeit == 25){ $this->getOwner()->zeit = 0; } } } ?> can you plz help me? Sry for my bad English
why you should use Listener in youre timer Task? try to delete the "implements Listener" in the PluginTask class
this PHP: public function __construct(Plugin/**/ $owner){//parent::__construct($owner);} should be PHP: public function __construct(Main $owner){parent::__construct($owner);}
You have to `use pocketmine\plugin\PluginTask;` in your Listener class. Also, in case you don't, remember that you have to put every class in its independent file.