1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Replace word.

Discussion in 'Plugin Help' started by Todo56, Jun 24, 2019.

  1. Todo56

    Todo56 Silverfish

    Messages:
    17
    GitHub:
    todo56
    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!
     
  2. awgybop1

    awgybop1 Creeper

    Messages:
    1
    GitHub:
    awgybop1
  3. Todo56

    Todo56 Silverfish

    Messages:
    17
    GitHub:
    todo56
    Thank you!
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.