Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Send Message to everybody

Comments in 'Plugin Development' started by btanercan, Sep 5, 2015.

  1. btanercan
    Offline

    btanercan New Member

    Joined:
    Jun 29, 2015
    Posts:
    3
    Minecraft User:
    BTanercan
    Hi! I want to send a message to everybody. How i can fix it ? Please help me :/

    I used it:

    Code:
    $event->getPlayer()->getName()->sendMessage(" joined the match.");
    But it dont work :/

    Error Log:

  2. btanercan
    Offline

    btanercan New Member

    Joined:
    Jun 29, 2015
    Posts:
    3
    Minecraft User:
    BTanercan
    If you tap a sign, you will join a game with "$player joined the game."
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    PHP:
    $player $event->getPlayer(); // You must get object instead of getName() string
    $targetPlayers $player->getLevel()->getPlayers(); // Player that will recieve message
    foreach($targetPlayers as $tP){
    $tp->sendMessage($player->getName().' joined the match');
    }
  4. btanercan
    Offline

    btanercan New Member

    Joined:
    Jun 29, 2015
    Posts:
    3
    Minecraft User:
    BTanercan
    Oh bro, thanks a lot :)
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    to everybody? use
    PHP:
    $server->getOnlinePlayers()
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why did you even getName()?

Share This Page

Advertisement