diff --git a/core/src/main/java/me/filoghost/holographicdisplays/core/Utils.java b/core/src/main/java/me/filoghost/holographicdisplays/core/Utils.java index 343f5274..c532706d 100644 --- a/core/src/main/java/me/filoghost/holographicdisplays/core/Utils.java +++ b/core/src/main/java/me/filoghost/holographicdisplays/core/Utils.java @@ -25,15 +25,6 @@ public class Utils { return result; } - - public static String limitLength(String s, int maxLength) { - if (s != null && s.length() > maxLength) { - s = s.substring(0, maxLength); - } - return s; - } - - public static int floor(double num) { int floor = (int) num; return floor == num ? floor : floor - (int) (Double.doubleToRawLongBits(num) >>> 63); diff --git a/nms/v1_10_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_10_R1/EntityNMSArmorStand.java b/nms/v1_10_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_10_R1/EntityNMSArmorStand.java index b11a1361..42cae0e6 100644 --- a/nms/v1_10_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_10_R1/EntityNMSArmorStand.java +++ b/nms/v1_10_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_10_R1/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_10_R1; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -171,7 +172,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(customName != null ? Utils.limitLength(customName, 256) : ""); + super.setCustomName(customName != null ? Strings.truncate(customName, 256) : ""); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_11_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_11_R1/EntityNMSArmorStand.java b/nms/v1_11_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_11_R1/EntityNMSArmorStand.java index 3c186c40..ba392866 100644 --- a/nms/v1_11_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_11_R1/EntityNMSArmorStand.java +++ b/nms/v1_11_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_11_R1/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_11_R1; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -171,7 +172,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(customName != null ? Utils.limitLength(customName, 256) : ""); + super.setCustomName(customName != null ? Strings.truncate(customName, 256) : ""); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_12_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_12_R1/EntityNMSArmorStand.java b/nms/v1_12_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_12_R1/EntityNMSArmorStand.java index 4696f49d..300054d9 100644 --- a/nms/v1_12_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_12_R1/EntityNMSArmorStand.java +++ b/nms/v1_12_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_12_R1/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_12_R1; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -171,7 +172,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(customName != null ? Utils.limitLength(customName, 256) : ""); + super.setCustomName(customName != null ? Strings.truncate(customName, 256) : ""); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_13_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R1/EntityNMSArmorStand.java b/nms/v1_13_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R1/EntityNMSArmorStand.java index 07335f7e..c8d23b79 100644 --- a/nms/v1_13_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R1/EntityNMSArmorStand.java +++ b/nms/v1_13_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R1/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_13_R1; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -173,7 +174,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(CraftChatMessage.fromStringOrNull(Utils.limitLength(customName, 300))); + super.setCustomName(CraftChatMessage.fromStringOrNull(Strings.truncate(customName, 300))); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_13_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R2/EntityNMSArmorStand.java b/nms/v1_13_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R2/EntityNMSArmorStand.java index e19d2e8c..1ebefc39 100644 --- a/nms/v1_13_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R2/EntityNMSArmorStand.java +++ b/nms/v1_13_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_13_R2/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_13_R2; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -173,7 +174,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(CraftChatMessage.fromStringOrNull(Utils.limitLength(customName, 300))); + super.setCustomName(CraftChatMessage.fromStringOrNull(Strings.truncate(customName, 300))); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_14_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_14_R1/EntityNMSArmorStand.java b/nms/v1_14_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_14_R1/EntityNMSArmorStand.java index de2cce16..bb6476da 100644 --- a/nms/v1_14_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_14_R1/EntityNMSArmorStand.java +++ b/nms/v1_14_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_14_R1/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_14_R1; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -175,7 +176,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(CraftChatMessage.fromStringOrNull(Utils.limitLength(customName, 300))); + super.setCustomName(CraftChatMessage.fromStringOrNull(Strings.truncate(customName, 300))); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_15_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_15_R1/EntityNMSArmorStand.java b/nms/v1_15_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_15_R1/EntityNMSArmorStand.java index 3c5a34c6..c0a29eab 100644 --- a/nms/v1_15_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_15_R1/EntityNMSArmorStand.java +++ b/nms/v1_15_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_15_R1/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_15_R1; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -175,7 +176,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(CraftChatMessage.fromStringOrNull(Utils.limitLength(customName, 300))); + super.setCustomName(CraftChatMessage.fromStringOrNull(Strings.truncate(customName, 300))); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_16_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R1/EntityNMSArmorStand.java b/nms/v1_16_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R1/EntityNMSArmorStand.java index 8b5bf787..1a6bdfa9 100644 --- a/nms/v1_16_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R1/EntityNMSArmorStand.java +++ b/nms/v1_16_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R1/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_16_R1; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -175,7 +176,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(CraftChatMessage.fromStringOrNull(Utils.limitLength(customName, 300))); + super.setCustomName(CraftChatMessage.fromStringOrNull(Strings.truncate(customName, 300))); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_16_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R2/EntityNMSArmorStand.java b/nms/v1_16_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R2/EntityNMSArmorStand.java index b95cee79..259d489d 100644 --- a/nms/v1_16_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R2/EntityNMSArmorStand.java +++ b/nms/v1_16_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R2/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_16_R2; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -175,7 +176,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(CraftChatMessage.fromStringOrNull(Utils.limitLength(customName, 300))); + super.setCustomName(CraftChatMessage.fromStringOrNull(Strings.truncate(customName, 300))); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_16_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R3/EntityNMSArmorStand.java b/nms/v1_16_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R3/EntityNMSArmorStand.java index 93d85203..231de2e4 100644 --- a/nms/v1_16_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R3/EntityNMSArmorStand.java +++ b/nms/v1_16_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_16_R3/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_16_R3; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -175,7 +176,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(CraftChatMessage.fromStringOrNull(Utils.limitLength(customName, 300))); + super.setCustomName(CraftChatMessage.fromStringOrNull(Strings.truncate(customName, 300))); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_8_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R2/EntityNMSArmorStand.java b/nms/v1_8_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R2/EntityNMSArmorStand.java index 29a45314..668ffbe5 100644 --- a/nms/v1_8_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R2/EntityNMSArmorStand.java +++ b/nms/v1_8_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R2/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_8_R2; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectMethod; import me.filoghost.holographicdisplays.core.DebugLogger; @@ -160,7 +161,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(customName != null ? Utils.limitLength(customName, 256) : ""); + super.setCustomName(customName != null ? Strings.truncate(customName, 256) : ""); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_8_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R3/EntityNMSArmorStand.java b/nms/v1_8_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R3/EntityNMSArmorStand.java index d923b946..508c2cee 100644 --- a/nms/v1_8_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R3/EntityNMSArmorStand.java +++ b/nms/v1_8_r3/src/main/java/me/filoghost/holographicdisplays/nms/v1_8_R3/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_8_R3; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.fcommons.reflection.ReflectMethod; import me.filoghost.holographicdisplays.core.DebugLogger; @@ -160,7 +161,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(customName != null ? Utils.limitLength(customName, 256) : ""); + super.setCustomName(customName != null ? Strings.truncate(customName, 256) : ""); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_9_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R1/EntityNMSArmorStand.java b/nms/v1_9_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R1/EntityNMSArmorStand.java index 5753ffcb..2ce0aadc 100644 --- a/nms/v1_9_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R1/EntityNMSArmorStand.java +++ b/nms/v1_9_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R1/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_9_R1; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -172,7 +173,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(customName != null ? Utils.limitLength(customName, 256) : ""); + super.setCustomName(customName != null ? Strings.truncate(customName, 256) : ""); super.setCustomNameVisible(customName != null && !customName.isEmpty()); } diff --git a/nms/v1_9_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R2/EntityNMSArmorStand.java b/nms/v1_9_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R2/EntityNMSArmorStand.java index 98b992a7..634986ba 100644 --- a/nms/v1_9_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R2/EntityNMSArmorStand.java +++ b/nms/v1_9_r2/src/main/java/me/filoghost/holographicdisplays/nms/v1_9_R2/EntityNMSArmorStand.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.nms.v1_9_R2; import me.filoghost.fcommons.Preconditions; +import me.filoghost.fcommons.Strings; import me.filoghost.fcommons.reflection.ReflectField; import me.filoghost.holographicdisplays.core.DebugLogger; import me.filoghost.holographicdisplays.core.Utils; @@ -172,7 +173,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta return; } this.customName = customName; - super.setCustomName(customName != null ? Utils.limitLength(customName, 256) : ""); + super.setCustomName(customName != null ? Strings.truncate(customName, 256) : ""); super.setCustomNameVisible(customName != null && !customName.isEmpty()); }