I'm really sorry, I know this is simple but : I can't find how to use the function setTime and stopTime of Level.php. PHP: public function changeTime(Level $setTime){ $this->setTime(6000); $this->stopTime(); } I didn't forget to use the Level file at the beginning of the code. It says : Thank you and sorry once again !
Yes sorry PHP: <?phpnamespace RealTime;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\Server;use pocketmine\utils\TextFormat;use pocketmine\event\Listener;use pocketmine\level\Level;class MainClass extends PluginBase implements Listener{ public function onLoad(){ $this->getLogger()->info(TextFormat::WHITE . "RealTime loaded."); } public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->changeTime(); // Schedule tell hour instead after $this->getLogger()->info(TextFormat::DARK_GREEN . "RealTime enabled."); } public function onDisable(){ $this->getLogger()->info(TextFormat::DARK_RED . "RealTime disabled."); } public function changeTime(Level $setTime){ $this->setTime(6000); $this->stopTime(); }public function tellTime(){ $times = date('H'); $minutes = date('i'); $time = $times + ($modify); if ($time > 23){ $time = $time - 24; } $this->broadcast("[RealTime] It is ". $time .":". $minutes .""); } }
I just don't understand why everyone wants to add a message "enabled" when there is already an "Enabling Plugin vVersion by Author" message.
Il just followed a plugin example available on github. Do you have any idea why it don't work ? Thanks
You called the function $this->changeTime() when you enable it, but you didn't pass parameters. I only have one answer: Learn PHP.
You're right, thanks. I finished the code academy tutorial, I think I will do it again.. Thanks anyways
I understand if you don't want to answer, but can somebody explain me which parameters do I have to put ? It will help me to undersatnd parameters. Thanks.
Am I far from what I want to do ? ^^ I found the function I want I think, but I can't find how to call it, will I find this in the docs ?
Thank you !!! I didn't need any parametres in fact, and I understood a very useful thing thanks to you )
You need no parameters. And you have no reason to put the Level $level parameter in the function declaration.