This is my code: PHP: public function onJoin(PlayerJoinEvent $event){$config = $this->getConfig();$player = $event->getPlayer();$x = $config->get("x");$y = $config->get("y");$z = $config->get("z");$text = $config->get("text");$position = new Vector3($x, $y + 0.5, $z);$player->getLevel()->addParticle(new FloatingTextParticle($position, $text));} The data is in the config but on PlayerJoinEvent isn't adding the particle, there's no errors or issues. Any ideas why it isn't working.
This is the config: Code: --- Texter: x: 132.276382 y: 126.156151 z: 126.156151 text: test ... @Primus
It's still not working. It will save everything to the config but it isn't spawning the particle like it should.
Added that and it looks like: PHP: public function onJoin(PlayerJoinEvent $event){$config = $this->getConfig();var_dump($config->getAll());$player = $event->getPlayer();$x = $config->get("x");$y = $config->get("y");$z = $config->get("z");$text = $config->get("text");$position = new Vector3($x, $y + 0.5, $z);$player->getLevel()->addParticle(new FloatingTextParticle($position, $text));} I get this on my console: Code: array(1) { ["Texter"]=> array(4) { ["x"]=> float(135.09642) ["y"]=> float(121.664162) ["z"]=> float(121.664162) ["text"]=> string(4) "test" } } Notice: Array to string conversion in phar://C:/Users/Jake/Downloads/ImagicalMine/ImagicalMine.phar/src/pocketmine/level/particle/FloatingTextParticle.php on line 99
Should it be: PHP: public function onJoin(PlayerJoinEvent $event){$config = $this->getConfig();var_dump($config->getAll());$player = $event->getPlayer();$x = $config->get(["x"]);$y = $config->get(["y"]);$z = $config->get(["z"]);$text = $config->get(["text"]);$position = new Vector3($x, $y + 0.5, $z);$player->getLevel()->addParticle(new FloatingTextParticle($position, $text));}
If you use $config->get("x"), the config has to be like: Code: --- x: 123 y: 456 z: 789 ... If your config is like what you posted, you should be using $config->getNested("Texter.x"). Otherwise, what do you think the Texter is there for? Of course not. Do you know what get(["x"]) means? It means to use an array as the key type, which is invalid. Can you not post if you are completely wild guessing?