Raise hologram line character limit

This commit is contained in:
filoghost 2022-03-12 00:15:51 +01:00
parent 54bc45ebb9
commit 559cba600c
14 changed files with 42 additions and 14 deletions

View File

@ -12,6 +12,8 @@ import org.bukkit.inventory.ItemStack;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -34,7 +36,7 @@ abstract class DataWatcherPacketBuilder<T> {
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;
}

View File

@ -11,6 +11,8 @@ import org.bukkit.inventory.ItemStack;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -33,7 +35,7 @@ abstract class DataWatcherPacketBuilder<T> {
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;
}

View File

@ -11,6 +11,8 @@ import org.bukkit.inventory.ItemStack;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -33,7 +35,7 @@ abstract class DataWatcherPacketBuilder<T> {
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;
}

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -15,6 +15,8 @@ import java.util.Optional;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -40,7 +42,7 @@ abstract class DataWatcherPacketBuilder<T> {
}
private Optional<IChatBaseComponent> 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 {

View File

@ -11,6 +11,8 @@ import org.bukkit.inventory.ItemStack;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -33,7 +35,7 @@ abstract class DataWatcherPacketBuilder<T> {
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;
}

View File

@ -12,6 +12,8 @@ import org.bukkit.inventory.ItemStack;
abstract class DataWatcherPacketBuilder<T> {
private static final int MAX_CUSTOM_NAME_LENGTH = 5000;
private final PacketByteBuffer packetByteBuffer;
DataWatcherPacketBuilder(PacketByteBuffer packetByteBuffer) {
@ -34,7 +36,7 @@ abstract class DataWatcherPacketBuilder<T> {
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;
}