Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7796

Kickplayer newlines not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • 4236-Spigot-cb8cf80-f993563 (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT)
    • Yes

      Using player.kickPlayer("ChatColor.RED + "SERVER SHUTDOWN!" + ChatColor.WHITE + "\nThe MineEmpire server was shutdown,\nwe will be back soon!");

      Will only show the first line "SERVER SHUTDOWN!" instead of all the lines.

      Expected result:

       

      This problem seems to come from:

      public void kickPlayer(String message) { 
        if (getHandle().c == null) { 
          return;
        }
        getHandle().c.a(CraftChatMessage.fromStringOrEmpty(message)); 
      }

       

      by default CraftChatMessage.fromStringOrEmpty(message); ignores newlines,

      using CraftChatMessage.fromStringOrEmpty(message, true); fixes this.

       

      Bypass:

      String message = ChatColor.RED + "SERVER SHUTDOWN!" + ChatColor.WHITE + "\nThe MineEmpire server was shutdown,\nwe will be back soon!";
      CraftPlayer cPlayer = (CraftPlayer) player;
      if (cPlayer != null) {
        if (cPlayer.getHandle() != null) {    cPlayer.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message, true));
        };
      };

       

            Unassigned Unassigned
            rick18 Rick
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: