Why "/n" doesn't work? help

Discussion in 'Spigot Plugin Development' started by --TOMAS--, Jun 12, 2016.

  1. /n doesn't work in server MOTD
    I have this code:
    Code (Text):
        public void MOTD(ServerListPingEvent e){
            //variables
            String motd = ChatColor.translateAlternateColorCodes('&', plugin.getMotdConfig().getString("MOTD"));
            Bukkit.getServer().getMotd().replace("%newline%", "/n");
            //action
            e.setMotd(motd);
        }
    Config:
    Code (Text):
    MOTD: '&bUltraLobby &5Works &lHere&e! %newline% &6&lJoin &2&lNow&3&l!'
    Game:

    Desktop 12-06-2016 06-48-17 p.m.-717.png
     
  2. Its not /n, its \n...
     
  3. Because it's \n not /n... \o/

    Aww sniped \/_\/
     
    • Winner Winner x 1
  4. LOL, thanks guys xD
     
  5. Sorry guys, doesnt work :( /n and \n
     
  6. Right, I can redeem myself and that snipe (I hope).

    Please review the code, the line where you replace %newline% with \n is left and redundant.

    You want to replace "Bukkit.getServer().getMotd()" with "motd = motd"
     
  7. So?
     
  8. so?
     
  9. u wot....
     
    • Optimistic Optimistic x 1
  10. Thanks man! It worked!
     
  11. It would make the code as so..

    Code (Text):
        public void MOTD(ServerListPingEvent e){
            //variables
            String motd = ChatColor.translateAlternateColorCodes('&', plugin.getMotdConfig().getString("MOTD"));
            motd = motd.replace("%newline%", "/n"); /////////// <---- NOTE THE "motd = motd".
            //action
            e.setMotd(motd);
        }