Newline won't work for player...

Discussion in 'Plugin Development' started by Hello Minecraft World, Feb 25, 2012.

Thread Status:
Not open for further replies.
  1. I've tried lots of different code and they all work in the console but none work for the player.
    here is an example of what i have tried:
    public String newline = String.format("%n");
    public String newline = "\n";
    public String newline = System.getProperty("Line.seperator");
    all of them work in the console but none for the player...
    Extra info:
    I'm using sender.sendMessage(motd.replaceAll("%NL%", newline);
  2. because \n doesn't work for the minecraft chat.
    If it's a player split the string at the \n positions and then send each part individually.
  3. Offline


    2. String[] message = event.getMessage().split("\n") // Split everytime the "\n" into a new array value
    4. for(int x=0 ; x<message.length ; x++) {
    5. Bukkit.broadcastMessage(message[x]); // Send each argument in the message
    6. }
    7. event.setCancelled(true); // So the message doesn't get sent twice
Thread Status:
Not open for further replies.

Share This Page