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

Text wrap in a broadcast

Comments in 'Plugin Development' started by Jag, May 14, 2014.

  1. Jag
    Offline

    Jag Active Member

    Joined:
    Mar 26, 2014
    Posts:
    53
    Minecraft User:
    Jag
    Hopefully there is a simple answer to this. But I have two servers and the same broadcast plugin acts differently in each one. The broadcast plugin spits out a long message. In one server the text wraps its self automatically, so its all in the screen of the viewer. In the second server only the left part of the text shows initially unless the reader hits the chat button. So the question is, how can I break up the broadcast so it automatically shows like this:
    The quick red
    fox jumped over
    the lazy brown dog

    rather than like this:
    The quick red fox jumped over the lazy brown dog?

    Thank you.
  2. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Welcome to the forums!
    Will this work?
    PHP:
    $this->api->chat->broadcast("The quick red");
    $this->api->chat->broadcast("fox jumped over");
    $this->api->chat->broadcast("the lazy brown dog.");
    Each line apears on a different line in chat
    Jag likes this.
  3. Jag
    Offline

    Jag Active Member

    Joined:
    Mar 26, 2014
    Posts:
    53
    Minecraft User:
    Jag
    Excellent works great. Thank you.
    Jag
  4. Jag
    Offline

    Jag Active Member

    Joined:
    Mar 26, 2014
    Posts:
    53
    Minecraft User:
    Jag
    Unfortunately I realized I asked the wrong question. I did not mean for the message to be broadcast but to be a specific message for the one player that issued to the command. I have tried coping it into this format but it isn't working:
    $this->api->chat->sendTo("The quick red");
    $this->api->chat->sendTo("fox jumped over");
    $this->api->chat->sendTo("the lazy brown dog.");

    Perhaps I need an identifier for the player issuing the command?
    Thank you.
  5. Beast Mode
    Offline

    Beast Mode Banned

    Joined:
    Apr 4, 2014
    Posts:
    16
    PHP:
    public function Command($data){
        
    $data->sendChat("The quick red");
        
    $data->sendChat("fox jumped over");
        
    $data->sendChat("the lazy brown dog.");
    }
    Use this! ;)
    Last edited: May 15, 2014
  6. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    Or use \n.
    wies, Jag and MegaSamNinja like this.
  7. MegaSamNinja
    Offline

    MegaSamNinja Active Member

    Joined:
    Sep 13, 2013
    Posts:
    138
    Minecraft User:
    Bamuel
    I was about to say that
  8. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    If you want to wrap text to n characters you can use wordwrap()
    wies likes this.
  9. Jag
    Offline

    Jag Active Member

    Joined:
    Mar 26, 2014
    Posts:
    53
    Minecraft User:
    Jag
    thanks that did the trick.
    LDX likes this.
  10. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Your welcome! Always willing to help!
  11. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    He was talking to me.
  12. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Oh, well I helped anyway (a bit).
    LDX likes this.
  13. Jag
    Offline

    Jag Active Member

    Joined:
    Mar 26, 2014
    Posts:
    53
    Minecraft User:
    Jag
    You supplied the right answer to question I asked, the fault was mine in asking the wrong question.
    PEMapModder likes this.
  14. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Lol.
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I will make a plugin automatically breaking the chat tonight.
    Jag likes this.
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I'd finished and submitted the plugin.

    [​IMG]
  17. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It is just the same. It will be samely foreach'ed in the function foreach().
  18. BukkitPE
    Offline

    BukkitPE Banned

    Joined:
    May 11, 2014
    Posts:
    16
    Minecraft User:
    MINEMASTER_28
    $this->api->chat->broadcast("The quick red \n "fox jumped over \n the lazy brown dog");
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The "
  20. BukkitPE
    Offline

    BukkitPE Banned

    Joined:
    May 11, 2014
    Posts:
    16
    Minecraft User:
    MINEMASTER_28
    opps lol ! copy and paste prob lol

Share This Page

Advertisement