Sending a List from a Config file?

Discussion in 'Plugin Development' started by Yazan, Nov 6, 2013.

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

    Yazan

    Hello, I'm trying to send a list from config file, this is what I mean:

    Config:
    Code:
    Ranks:
    -Test: this rank is a test.
    -Test2: this is test2 rank.
    -Test3: this is test3 rank.
    and I want to send the list to a player at one time, any help?
    Thanks for taking some time to read my post :)
     
  2. Offline

    sd5

    Yazan
    What exactly do you mean with "at one time"?

    Do you mean something like this:
    Code:java
    1. List<String> messages = getConfig().getStringList("Ranks");
    2. for(String m : messages) {
    3. player.sendMessage(m);
    4. }

    or do you mean with only one player.sendMessage() / setJoinMessage()?
    Then you would have to concatenate all list items first:
    Code:java
    1. List<String> messages = getConfig().getStringList("Ranks");
    2. String message = "";
    3. for(String m : messages) {
    4. message += m;
    5. message += "\n";
    6. }
    7. player.sendMessage(message);
     
    CoolGamerXD and Yazan like this.
  3. Offline

    Yazan

    I'll try that, thanks!

    sd5 it works! thank you so much! but one more question, how do I translate colours in config? like I want to use & in config how do I do that?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  4. Offline

    sd5

Thread Status:
Not open for further replies.

Share This Page