I'm trying to replace the string $name with the player name on a string that's stored in a yml file. Is there any way to do it? Here's my code: PHP: function onJoin(PlayerJoinEvent $event) { $player = $event->getPlayer(); $name = $player->getDisplayName(); $event->setJoinMessage(null); $this->getServer()->broadcastMessage($this->getConfig()->get(join-message')); } Yml file: Code: join-message: Welcome $name to this server!
Use str_replace to replace the $name with the player's name. https://www.php.net/manual/en/function.str-replace.php