I'm trying to get data from a config and I keep getting this Warning and I have no idea what I'm doing wrong... Code: PHP: public function __construct(Main $main) { $this->plugin = $main; } public function onJoin(PlayerJoinEvent $event) { $config = $this->plugin->getConfig()->getAll(); $player = $event->getPlayer(); $message = $config["Join"]["Popup"]["Public-Popup-Text"]; $duration = $config["Join"]["Popup"]["Public-Popup-Duration"]; $this->plugin->schedulePopup($player, str_replace("@player", $player->getName(), $message), $duration); } Error/Warning: Code: [18:56:04] [Server thread/WARNING]: RuntimeException: "yaml_parse(): end of stream reached without finding document 0" (E_WARNING) in "/src/pocketmine/utils/Config" at line 143 [18:56:04] [Server thread/INFO]: CrazedMiner joined the game
Did you save the default configuration file correctly? PHP: @mkdir($this->getDataFolder());$this->saveDefaultConfig();
Yup Main.php PHP: public function onEnable() { @mkdir($this->getDataFolder()); $this->saveDefaultConfig(); $this->getServer()->getPluginManager()->registerEvents(new Events\Join($this), $this); } Join.php PHP: public function __construct(Main $main) { $this->plugin = $main; } public function onJoin(PlayerJoinEvent $event) { $config = $this->plugin->getConfig()->getAll(); $player = $event->getPlayer(); $message = $config["join"]["popup"]["public-popup-text"]; $duration = $config["join"]["popup"]["public-popup-duration"]; $this->plugin->schedulePopup($player, str_replace("@player", $player->getName(), $message), $duration); } Config.yml Code: --- join: popup: public-popup-enabled: true public-popup-text: "&l&[email protected]&r has &bjoined&r the TakeTwo Network!" public-popup-duration: 6 ... Error Code: [19:50:27] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'TakeTwo-Core-v1 v': Undefined index: join on TakeTwo\Events\Join [19:50:27] [Server thread/NOTICE]: ArrayOutOfBoundsException: "Undefined index: join" (E_NOTICE) in "/TakeTwo-Core-v1/src/TakeTwo/Events/Join" at line 19
Sa same error .-. Code: [20:39:43] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'TakeTwo-Core-v1 v': Undefined index: join on TakeTwo\Events\Join [20:39:43] [Server thread/NOTICE]: ArrayOutOfBoundsException: "Undefined index: join" (E_NOTICE) in "/TakeTwo-Core-v1/src/TakeTwo/Events/Join" at line 19