From 559cba600c531abfb6207a350fb6d263d33628bd Mon Sep 17 00:00:00 2001 From: filoghost Date: Sat, 12 Mar 2022 00:15:51 +0100 Subject: [PATCH] Raise hologram line character limit --- .../nms/v1_10_R1/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_11_R1/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_12_R1/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_13_R2/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_14_R1/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_15_R1/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_16_R1/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_16_R2/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_16_R3/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_17_R1/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_18_R1/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_18_R2/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_8_R3/DataWatcherPacketBuilder.java | 4 +++- .../nms/v1_9_R2/DataWatcherPacketBuilder.java | 4 +++- 14 files changed, 42 insertions(+), 14 deletions(-) diff --git a/nms/v1_10_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_10_R1/DataWatcherPacketBuilder.java b/nms/v1_10_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_10_R1/DataWatcherPacketBuilder.java index ba0e81b8..10c2425b 100644 --- a/nms/v1_10_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_10_R1/DataWatcherPacketBuilder.java +++ b/nms/v1_10_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_10_R1/DataWatcherPacketBuilder.java @@ -12,6 +12,8 @@ import org.bukkit.inventory.ItemStack; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -34,7 +36,7 @@ abstract class DataWatcherPacketBuilder { if (customName == null) { customName = ""; } - packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, 300)); + packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH)); packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME_VISIBILITY, !Strings.isEmpty(customName)); return this; } diff --git a/nms/v1_11_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_11_R1/DataWatcherPacketBuilder.java b/nms/v1_11_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_11_R1/DataWatcherPacketBuilder.java index d8fdd241..a5d9ac82 100644 --- a/nms/v1_11_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_11_R1/DataWatcherPacketBuilder.java +++ b/nms/v1_11_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_11_R1/DataWatcherPacketBuilder.java @@ -11,6 +11,8 @@ import org.bukkit.inventory.ItemStack; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -33,7 +35,7 @@ abstract class DataWatcherPacketBuilder { if (customName == null) { customName = ""; } - packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, 300)); + packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH)); packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME_VISIBILITY, !Strings.isEmpty(customName)); return this; } diff --git a/nms/v1_12_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_12_R1/DataWatcherPacketBuilder.java b/nms/v1_12_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_12_R1/DataWatcherPacketBuilder.java index 6f9512db..70d1534f 100644 --- a/nms/v1_12_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_12_R1/DataWatcherPacketBuilder.java +++ b/nms/v1_12_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_12_R1/DataWatcherPacketBuilder.java @@ -11,6 +11,8 @@ import org.bukkit.inventory.ItemStack; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -33,7 +35,7 @@ abstract class DataWatcherPacketBuilder { if (customName == null) { customName = ""; } - packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, 300)); + packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH)); packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME_VISIBILITY, !Strings.isEmpty(customName)); return this; } diff --git a/nms/v1_13_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R2/DataWatcherPacketBuilder.java b/nms/v1_13_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R2/DataWatcherPacketBuilder.java index c739f3b3..4d85f3d7 100644 --- a/nms/v1_13_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R2/DataWatcherPacketBuilder.java +++ b/nms/v1_13_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R2/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false)[0]); } else { diff --git a/nms/v1_14_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_14_R1/DataWatcherPacketBuilder.java b/nms/v1_14_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_14_R1/DataWatcherPacketBuilder.java index eb30bd60..18da8358 100644 --- a/nms/v1_14_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_14_R1/DataWatcherPacketBuilder.java +++ b/nms/v1_14_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_14_R1/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false)[0]); } else { diff --git a/nms/v1_15_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_15_R1/DataWatcherPacketBuilder.java b/nms/v1_15_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_15_R1/DataWatcherPacketBuilder.java index 0acef481..636d2365 100644 --- a/nms/v1_15_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_15_R1/DataWatcherPacketBuilder.java +++ b/nms/v1_15_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_15_R1/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false)[0]); } else { diff --git a/nms/v1_16_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R1/DataWatcherPacketBuilder.java b/nms/v1_16_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R1/DataWatcherPacketBuilder.java index 39ac7bf3..9626918a 100644 --- a/nms/v1_16_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R1/DataWatcherPacketBuilder.java +++ b/nms/v1_16_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R1/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false)[0]); } else { diff --git a/nms/v1_16_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R2/DataWatcherPacketBuilder.java b/nms/v1_16_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R2/DataWatcherPacketBuilder.java index bc2a9450..a637b0e2 100644 --- a/nms/v1_16_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R2/DataWatcherPacketBuilder.java +++ b/nms/v1_16_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R2/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false)[0]); } else { diff --git a/nms/v1_16_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R3/DataWatcherPacketBuilder.java b/nms/v1_16_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R3/DataWatcherPacketBuilder.java index 2e45682d..3c8d73d5 100644 --- a/nms/v1_16_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R3/DataWatcherPacketBuilder.java +++ b/nms/v1_16_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R3/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false, true)[0]); } else { diff --git a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/DataWatcherPacketBuilder.java b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/DataWatcherPacketBuilder.java index 3707808e..4ec750c7 100644 --- a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/DataWatcherPacketBuilder.java +++ b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false, true)[0]); } else { diff --git a/nms/v1_18_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_18_R1/DataWatcherPacketBuilder.java b/nms/v1_18_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_18_R1/DataWatcherPacketBuilder.java index 581da78e..3893165b 100644 --- a/nms/v1_18_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_18_R1/DataWatcherPacketBuilder.java +++ b/nms/v1_18_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_18_R1/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false, true)[0]); } else { diff --git a/nms/v1_18_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_18_R2/DataWatcherPacketBuilder.java b/nms/v1_18_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_18_R2/DataWatcherPacketBuilder.java index e4fab10f..1344f840 100644 --- a/nms/v1_18_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_18_R2/DataWatcherPacketBuilder.java +++ b/nms/v1_18_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_18_R2/DataWatcherPacketBuilder.java @@ -15,6 +15,8 @@ import java.util.Optional; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder { } private Optional getCustomNameDataWatcherValue(String customName) { - customName = Strings.truncate(customName, 300); + customName = Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH); if (!Strings.isEmpty(customName)) { return Optional.of(CraftChatMessage.fromString(customName, false, true)[0]); } else { diff --git a/nms/v1_8_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R3/DataWatcherPacketBuilder.java b/nms/v1_8_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R3/DataWatcherPacketBuilder.java index ed269b3d..a38f50ae 100644 --- a/nms/v1_8_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R3/DataWatcherPacketBuilder.java +++ b/nms/v1_8_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R3/DataWatcherPacketBuilder.java @@ -11,6 +11,8 @@ import org.bukkit.inventory.ItemStack; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -33,7 +35,7 @@ abstract class DataWatcherPacketBuilder { if (customName == null) { customName = ""; } - packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, 300)); + packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH)); packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME_VISIBILITY, Strings.isEmpty(customName) ? (byte) 0 : (byte) 1); return this; } diff --git a/nms/v1_9_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R2/DataWatcherPacketBuilder.java b/nms/v1_9_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R2/DataWatcherPacketBuilder.java index 21828b74..bec244d6 100644 --- a/nms/v1_9_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R2/DataWatcherPacketBuilder.java +++ b/nms/v1_9_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R2/DataWatcherPacketBuilder.java @@ -12,6 +12,8 @@ import org.bukkit.inventory.ItemStack; abstract class DataWatcherPacketBuilder { + private static final int MAX_CUSTOM_NAME_LENGTH = 5000; + private final PacketByteBuffer packetByteBuffer; DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) { @@ -34,7 +36,7 @@ abstract class DataWatcherPacketBuilder { if (customName == null) { customName = ""; } - packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, 300)); + packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME, Strings.truncate(customName, MAX_CUSTOM_NAME_LENGTH)); packetByteBuffer.writeDataWatcherEntry(DataWatcherKey.CUSTOM_NAME_VISIBILITY, !Strings.isEmpty(customName)); return this; }