[SPIGOT-7796] Kickplayer newlines not working Created: 23/Jun/24 Updated: 25/Dec/24 Resolved: 23/Jun/24 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Rick | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | 1.21 | ||
| Attachments: |
|
| Version: | 4236-Spigot-cb8cf80-f993563 (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT) |
| Guidelines Read: | Yes |
| Description |
|
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)); }; };
|