Don't ignore newlines in PlayerListHeader/Footer

By: Yannick Lamprecht <yannicklamprecht@live.de>
This commit is contained in:
CraftBukkit/Spigot 2019-03-10 11:04:15 +11:00
parent d8321eeba1
commit 6caa3d0de8
2 changed files with 9 additions and 5 deletions

View file

@ -243,20 +243,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setPlayerListHeader(String header) {
this.playerListHeader = CraftChatMessage.fromStringOrNull(header);
this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true);
updatePlayerListHeaderFooter();
}
@Override
public void setPlayerListFooter(String footer) {
this.playerListFooter = CraftChatMessage.fromStringOrNull(footer);
this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true);
updatePlayerListHeaderFooter();
}
@Override
public void setPlayerListHeaderFooter(String header, String footer) {
this.playerListHeader = CraftChatMessage.fromStringOrNull(header);
this.playerListFooter = CraftChatMessage.fromStringOrNull(footer);
this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true);
this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true);
updatePlayerListHeaderFooter();
}

View file

@ -143,7 +143,11 @@ public final class CraftChatMessage {
}
public static IChatBaseComponent fromStringOrNull(String message) {
return (message == null || message.isEmpty()) ? null : fromString(message)[0];
return fromStringOrNull(message, false);
}
public static IChatBaseComponent fromStringOrNull(String message, boolean keepNewlines) {
return (message == null || message.isEmpty()) ? null : fromString(message, keepNewlines)[0];
}
public static IChatBaseComponent[] fromString(String message) {