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

Plugin Developement Help

Comments in 'Plugin Development' started by Ilikemining1, Mar 27, 2015.

  1. Ilikemining1
    Offline

    Ilikemining1 New Member

    Joined:
    Oct 28, 2014
    Posts:
    2
    Minecraft User:
    Ilikemining1
    How would you print text to chat with pocketmine api?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    For a Player object: $player->sendMessage($msg);
    For all players in a Server object: $this->getServer()->broadcastMessage($msg);
    EvolSoft, Ilikemining1 and xFlare like this.
  3. xFlare
    Offline

    xFlare Active Member Plugin Developer

    Joined:
    Sep 28, 2014
    Posts:
    199
    Plugins:
    1
    Minecraft User:
    xFlare
    And to get the object use: $event->getPlayer()

    If it's the $sender it's already the player object. :)
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No, $sender may be other types such as ConsoleCommandSender. There may be other command sender classes too, such as those from plugins. And not everyone calls it $sender.
    $event->getPlayer() is only the doer of the event.
    Falk and CrazedMiner like this.
  5. Ilikemining1
    Offline

    Ilikemining1 New Member

    Joined:
    Oct 28, 2014
    Posts:
    2
    Minecraft User:
    Ilikemining1
    Thank You that worked, I'm very new to php and pocketmine coding so thank you for being helpful.

Share This Page

Advertisement