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

Send message from Plugin

Comments in 'Plugin Development' started by DunxandMinecraft, Aug 7, 2015.

  1. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Hey.

    There are two types of messages i want to send from the plugin I am making.
    - Specific World Messages with Timings
    - Messages that are for all server but are at random timing but MUST be at least 2 minutes apart.

    Tell me how this is possible :)
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    Use time() and ticks.
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    for specific world:
    PHP:
    foreach($level->getPlayers() as $p){
    $p->sendMessage('Players who are in same world will only see this');
    }
    or
    PHP:
    $this->getServer()->broadcastMessage('Message'$level->getPlayers());
    for all server:
    PHP:
    $this->getServer()->broadcastMessage('This message will see all players on server! '); // Except if other plugin is not interupting or chat is not muted
    Timings? You mean delayTask?
    DunxandMinecraft likes this.
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    Yes primus. Use mt_rand and select a value. Use that value as ticks if you want. Tasks are the best.
  5. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    On the world ones where do I put the level name?
  6. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    PHP:
    $level $this->getServer()->getLevelByName()
  7. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV

Share This Page

Advertisement