[1.7.2] Multi-Line MOTD?

Discussion in 'Plugin Development' started by MOMOTHEREAL, Dec 8, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    MOMOTHEREAL

    Hello,
    I am updating my plugin to 1.7.2.
    I have a custom MOTD system. What I am wondering is how I can do a multi-lined MOTD (I saw a lot of servers with these). I tried the "\n", but it is not working. The second line is not showing up.
     
  2. Offline

    felixfritz

    You have to send those messages each one by one. If it's in a config file, you could maybe create a string list for that and loop through it.
     
  3. Offline

    MOMOTHEREAL

    Could you show me an example?
     
  4. Offline

    L33m4n123


    the config would look something like this

    Code:
    messages:
      - Message 1
      - Message 2
      - Message 3
      - Message 4
      - Message 5
      - Message 6
    And then you would just simply need to
    Code:java
    1. List<String> messages = new ArrayList<String>();
    2. messages = config.getStringList("messages");
    3. for (String message : messages) {
    4. Bukkit.broadcast(message);
    5. }
     
  5. Offline

    MOMOTHEREAL

    I am not using a config. I want to set the second line in my code, but how?
     
  6. Offline

    L33m4n123

    What he said


    Bukkit.getServer().boradcastMessage("Line One");
    Bukkit.getServer().boradcastMessage("Line Two");
     
  7. Offline

    MOMOTHEREAL

    Hoooooo, I know why! We are not even talking about the same thing! ;)
    I am talking of the MOTD in the ServerListPingEvent! :3
     
  8. Offline

    L33m4n123


    Ohhh. I thought you meant the one when you join the server that is sent to players.

    Which one you mean with ServerListPingEvent. The one that stands underneath the Server? Don't think you can do it multiple lines. If you can do it then you probably need to add enough spaces at the end of the first message and basicly have it as one message
     
  9. Offline

    MOMOTHEREAL

    Indeed, it can have up to 2 lines in the motd. I am going to try the spaces.
     
  10. Offline

    Conarnar

    Actually I think it takes a long String and wraps it around so just use a very long string instead.
     
Thread Status:
Not open for further replies.

Share This Page