hello i am working on a multi language plugin but there is 1 error and i cannot find the problem error: Spoiler PHP: Notice: Undefined property: Mcrafters\MultiLanguage\Main::$data in /Users/Ronny/Desktop/v20/plugins/MultiLanguage-master/src/Mcrafters/MultiLanguage/Main.php on line 44[07:02:39] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Test v1': Call to a member function get() on null on MCrafterss\test[07:02:39] [Server thread/CRITICAL]: Error: "Call to a member function get() on null" (EXCEPTION) in "/MultiLanguage-master/src/Mcrafters/MultiLanguage/Main" at line 44 github page: https://github.com/BoxOfDevs/MultiLanguage
Did you delete the event on line 44 ? Also are you missed the Case sensitive ? PHP: $this->data = new Config($this->getDataFolder()."Data.yml", Config::YAML, array());$this->saveResource("data.yml"); // Right here Also, where's your Data.yml file in your Resource folder ?
Why set/get something in Config with null ? The $player is Player, not Player's Name PHP: public function onJoin(PlayerJoinEvent $event){ $event->getPlayer()->sendMessage(ML::getInstance()->Translate($event->getPlayer()->getName(), "testmessage")); } Also you shouldn't use PlayerJoinEvent, use PlayerLoginEvent. And get the Player's name in the function, not in the sendMessage. PHP: public function Translate(Player $player, $message, bool $force = false, $issuer = "none") : int{ $player = $player->getName(); if ($this->getPlayerLang($player) === "nl"){ $this->NL->get($message); } if ($this->getPlayerLang($player) === "en"){ $this->EN->get($message); } if ($this->getPlayerLang($player) === "fr"){ $this->FR->get($message); } if ($this->getPlayerLang($player)=== "de"){ $this->DE->get($message); } }
Notice: Undefined property: pocketmine\event\player\PlayerJoinEvent::$getPlayer in /Users/Ronny/Desktop/v20/plugins/testplugin/src/Mcrafterss/test.php on line 18 [07:00:24] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Test v1': Call to a member function sendMessage() on null on MCrafterss\test [07:00:24] [Server thread/CRITICAL]: Error: "Call to a member function sendMessage() on null" (EXCEPTION) in "/testplugin/src/Mcrafterss/test" at line 18