mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-23 19:05:12 +01:00
Use FCommons utility method
This commit is contained in:
parent
588e2ed394
commit
177598ae78
@ -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);
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user