Solved Can't Get Multiple Message Lines to Appear

Discussion in 'Spigot Plugin Development' started by YourCoal, May 21, 2017.

  1. I have this thing where when a staff member bans another player, the message is stored in a string[]. I use the following code to put it together in a message to the player being banned, but it only shows the first message. Any idea what is wrong with this?
    Code (Text):

                StringBuilder buffer = new StringBuilder();
                for(int i = 5; i < reason.length; i++) {
                    buffer.append(' ').append(reason[i]+"\n");
                }
                String msg = buffer.toString();
                player.kickPlayer(CivColor.LightBlueBold+" « CivilizationCraft »"+"\n"+msg); //message not being displayed, no error in console
     
    [​IMG]
     
  2. Maybe put a space, because it's getting merged with another string.
    Maybe like this " \n " instead of "\n"
     
  3. Did you try printing out the message to the console? Maybe it's empty
     
  4. I did try this, it appears that after the first line it begins the 2nd line, but nothing else appears.
     
  5. Well, just use something like:
    Code (Text):
                StringBuilder str = new StringBuilder();
                for (int i = 0; i < args.length; i++) {
                    str.append(args[i] + " ");
                }
                p.kickPlayer("§b(CizvilizationCraft)" + "\n" + "§cReason:§f " + str);
    This will kick the commandsender, and will give the message what he put after the command.
     
  6. This worked for the most part, I just had to edit some text in another class file. Thank you!