diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/bridge/protocollib/ProtocolLibHook.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/bridge/protocollib/ProtocolLibHook.java index 989e2acb..c0fb38a9 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/bridge/protocollib/ProtocolLibHook.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/bridge/protocollib/ProtocolLibHook.java @@ -81,7 +81,11 @@ public class ProtocolLibHook { WrappedDataWatcher dataWatcher = spawnEntityPacket.getMetadata(); String customName = dataWatcher.getString(customNameWatcherIndex); - + + if (customName == null) { + return; + } + if (customName.contains("{player}") || customName.contains("{displayname}")) { WrappedDataWatcher dataWatcherClone = dataWatcher.deepClone(); @@ -144,10 +148,10 @@ public class ProtocolLibHook { for (int i = 0; i < dataWatcherValues.size(); i++) { - if (dataWatcherValues.get(i).getIndex() == customNameWatcherIndex) { + if (dataWatcherValues.get(i).getIndex() == customNameWatcherIndex && dataWatcherValues.get(i).getValue() != null) { Object customNameObject = dataWatcherValues.get(i).deepClone().getValue(); - if (customNameObject instanceof String == false) { + if (customNameObject == null || customNameObject instanceof String == false) { return; } @@ -167,7 +171,7 @@ public class ProtocolLibHook { } } } - } + } }); return true; diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_6_R3/EntityNMSHorse.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_6_R3/EntityNMSHorse.java index 87821420..62702b2d 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_6_R3/EntityNMSHorse.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_6_R3/EntityNMSHorse.java @@ -68,7 +68,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { @Override public boolean isInvulnerable() { - /* + /* * The field Entity.invulnerable is private. * It's only used while saving NBTTags, but since the entity would be killed * on chunk unload, we prefer to override isInvulnerable(). @@ -108,7 +108,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { name = name.substring(0, 64); } super.setCustomName(name); - super.setCustomNameVisible(name != null); + super.setCustomNameVisible(name != null && !name.isEmpty()); } @Override diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R1/EntityNMSHorse.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R1/EntityNMSHorse.java index f8fb273d..0997e61d 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R1/EntityNMSHorse.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R1/EntityNMSHorse.java @@ -68,7 +68,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { @Override public boolean isInvulnerable() { - /* + /* * The field Entity.invulnerable is private. * It's only used while saving NBTTags, but since the entity would be killed * on chunk unload, we prefer to override isInvulnerable(). @@ -108,7 +108,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { name = name.substring(0, 300); } super.setCustomName(name); - super.setCustomNameVisible(name != null); + super.setCustomNameVisible(name != null && !name.isEmpty()); } @Override diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R2/EntityNMSHorse.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R2/EntityNMSHorse.java index f47da365..0f938694 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R2/EntityNMSHorse.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R2/EntityNMSHorse.java @@ -68,7 +68,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { @Override public boolean isInvulnerable() { - /* + /* * The field Entity.invulnerable is private. * It's only used while saving NBTTags, but since the entity would be killed * on chunk unload, we prefer to override isInvulnerable(). @@ -108,7 +108,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { name = name.substring(0, 300); } super.setCustomName(name); - super.setCustomNameVisible(name != null); + super.setCustomNameVisible(name != null && !name.isEmpty()); } @Override diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R3/EntityNMSHorse.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R3/EntityNMSHorse.java index 0aa9029e..cfaceaf1 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R3/EntityNMSHorse.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R3/EntityNMSHorse.java @@ -68,7 +68,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { @Override public boolean isInvulnerable() { - /* + /* * The field Entity.invulnerable is private. * It's only used while saving NBTTags, but since the entity would be killed * on chunk unload, we prefer to override isInvulnerable(). @@ -108,7 +108,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { name = name.substring(0, 300); } super.setCustomName(name); - super.setCustomNameVisible(name != null); + super.setCustomNameVisible(name != null && !name.isEmpty()); } @Override diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R4/EntityNMSHorse.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R4/EntityNMSHorse.java index 6c588c92..ac3f4940 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R4/EntityNMSHorse.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_7_R4/EntityNMSHorse.java @@ -68,7 +68,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { @Override public boolean isInvulnerable() { - /* + /* * The field Entity.invulnerable is private. * It's only used while saving NBTTags, but since the entity would be killed * on chunk unload, we prefer to override isInvulnerable(). @@ -108,7 +108,7 @@ public class EntityNMSHorse extends EntityHorse implements NMSHorse { name = name.substring(0, 300); } super.setCustomName(name); - super.setCustomNameVisible(name != null); + super.setCustomNameVisible(name != null && !name.isEmpty()); } @Override diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_8_R1/EntityNMSArmorStand.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_8_R1/EntityNMSArmorStand.java index 26fe9811..be2fc4f7 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_8_R1/EntityNMSArmorStand.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_8_R1/EntityNMSArmorStand.java @@ -67,7 +67,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta @Override public boolean isInvulnerable(DamageSource source) { - /* + /* * The field Entity.invulnerable is private. * It's only used while saving NBTTags, but since the entity would be killed * on chunk unload, we prefer to override isInvulnerable(). @@ -141,7 +141,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta name = name.substring(0, 300); } super.setCustomName(name); - super.setCustomNameVisible(name != null); + super.setCustomNameVisible(name != null && !name.isEmpty()); } @Override diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/object/line/CraftTextLine.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/object/line/CraftTextLine.java index d08fc5a6..7da96d1f 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/object/line/CraftTextLine.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/object/line/CraftTextLine.java @@ -41,12 +41,14 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine { if (nmsNameble != null) { if (text != null && !text.isEmpty()) { nmsNameble.setCustomNameNMS(text); + if (getParent().isAllowPlaceholders()) { + PlaceholdersManager.trackIfNecessary(this); + } } else { - nmsNameble.setCustomNameNMS(null); - } - - if (getParent().isAllowPlaceholders()) { - PlaceholdersManager.trackIfNecessary(this); + nmsNameble.setCustomNameNMS(""); // It will not appear + if (getParent().isAllowPlaceholders()) { + PlaceholdersManager.untrack(this); + } } } }