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

How can i send message to a player during an event?

Comments in 'Plugin Development' started by CoolGuyPL, Nov 3, 2014.

  1. CoolGuyPL
    Offline

    CoolGuyPL New Member

    Joined:
    Sep 24, 2014
    Posts:
    43
    Minecraft User:
    CoolGuyPlays
    well how can I?
    ChipsCrafterHD likes this.
  2. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    It depends on what event you're going to use.

    For example, Entity events:
    $event->getEntity()->sendMessage("your message here");

    For Player event:
    $event->getPlayer()->sendMessage("your message here");
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    There is no sendMessage() method in the Entity class
    >.< check instanceof Player.

    Or well, it should depend on who you are sending to. After getting the player object, ->sendMessage("message") it.

    There are different methods to get different players in different cases. Read the docs for details.
  4. CoolGuyPL
    Offline

    CoolGuyPL New Member

    Joined:
    Sep 24, 2014
    Posts:
    43
    Minecraft User:
    CoolGuyPlays
    uhh the $event here is the actual event's variable? like
    PHP:
    public function whatever(whateverevent $wee){
    }
    the $wee there?
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yes, but different events have different methods.

    You are a good observer. Continue studying other plugins and you gonna make successful plugins? :)
    CoolGuyPL likes this.
  6. CoolGuyPL
    Offline

    CoolGuyPL New Member

    Joined:
    Sep 24, 2014
    Posts:
    43
    Minecraft User:
    CoolGuyPlays
    can you mention some events like that?
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    CoolGuyPL likes this.

Share This Page

Advertisement