Sending multiple values of a key as one message

Discussion in 'Plugin Development' started by McNewbie95, Oct 7, 2021.

  1. Offline

    McNewbie95

    Can anyone enlighten me and help me make this code send the values as one message?

    Code:
    if (args.length == 0) {
    Player p = (Player) sender;
    for (String key : this.getConfig().getConfigurationSection("sample").getKeys(false)) {
    String msg = this.getConfig().getString("sample." + key + ".value");
    sender.sendMessage(msg);​
    }​
    }




    Config File
    sample:
    name1:
    value: ab​
    name2:
    value: cd​
    name3:
    value: ef​





    Output:
    ab
    cd
    ef



    I wanted it to be like this:
    ab, cd, ef
     
  2. Offline

    timtower Administrator Administrator Moderator

    @McNewbie95 Make a single string, add the msg values to it.
    Send single string
     
    davidclue likes this.

Share This Page