2019-02-25 10:39:24 +01:00
|
|
|
From 6f777644facfe0beaca514e3f9993ce98b6cc5a0 Mon Sep 17 00:00:00 2001
|
2018-09-01 12:33:50 +02:00
|
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
|
|
Date: Sat, 1 Sep 2018 11:29:52 +0100
|
|
|
|
Subject: [PATCH] fix newlines in spigot tab list API
|
|
|
|
|
|
|
|
Spigots implementation around the header/footer strips newlines from the
|
|
|
|
header/footer, this patch allows the tab list header/footer to retain newlines.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2019-02-25 10:39:24 +01:00
|
|
|
index ce58cfc11..143779dfc 100644
|
2018-09-01 12:33:50 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2019-01-02 19:10:14 +01:00
|
|
|
@@ -368,20 +368,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2018-09-01 12:33:50 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setPlayerListHeader(String header) {
|
|
|
|
- this.playerListHeader = CraftChatMessage.fromStringOrNull(header);
|
|
|
|
+ this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true); // Paper - fix up spigot tab API
|
|
|
|
updatePlayerListHeaderFooter();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setPlayerListFooter(String footer) {
|
|
|
|
- this.playerListFooter = CraftChatMessage.fromStringOrNull(footer);
|
|
|
|
+ this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true); // Paper - fix up spigot tab API
|
|
|
|
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); // Paper - fix up spigot tab API
|
|
|
|
+ this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true); // Paper - fix up spigot tab API
|
|
|
|
updatePlayerListHeaderFooter();
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
2019-02-25 10:39:24 +01:00
|
|
|
index a067e39d5..5e20a9a61 100644
|
2018-09-01 12:33:50 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
|
|
@@ -143,7 +143,13 @@ public final class CraftChatMessage {
|
|
|
|
}
|
|
|
|
|
|
|
|
public static IChatBaseComponent fromStringOrNull(String message) {
|
|
|
|
- return (message == null || message.isEmpty()) ? null : fromString(message)[0];
|
|
|
|
+ // Paper start - fix up spigot tab API
|
|
|
|
+ return fromStringOrNull(message, false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static IChatBaseComponent fromStringOrNull(String message, boolean keepNewlines) {
|
|
|
|
+ return (message == null || message.isEmpty()) ? null : fromString(message, keepNewlines)[0];
|
|
|
|
+ // Paper end - fix up spigot tab API
|
|
|
|
}
|
|
|
|
|
|
|
|
public static IChatBaseComponent[] fromString(String message) {
|
|
|
|
--
|
2019-01-01 04:15:55 +01:00
|
|
|
2.20.1
|
2018-09-01 12:33:50 +02:00
|
|
|
|