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

[Solved] [NewAPI] Sending Message to Player

Comments in 'Plugin Development' started by MasterDoctor, Sep 20, 2014.

  1. MasterDoctor
    Offline

    MasterDoctor New Member

    Joined:
    Sep 19, 2014
    Posts:
    11
    Minecraft User:
    MasterDoctor
    I am quite new to PocketMine API.
    I am using the new API (1.4.0)

    1) How do you test if a player is OP - in an if statement - (my player is stored in $player)?

    2) How do you send a message to a player in the onCommand?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $player->isOp() returns whether the player is op.

    $var->sendMessage($message) sends a chat message to the specified player, where $var is an instance of CommandSender, and instances of Player, ConsoleCommandSender and RemoteConsoleCommandSender are all instances of CommandSender.

    You can refer to the PocketMine documentation for that.
    EvolSoft, iJoshuaHD and MasterDoctor like this.

Share This Page

Advertisement