From f3c6346b957ed7934faf783b444be6074b24b947 Mon Sep 17 00:00:00 2001 From: GJ Date: Mon, 8 Apr 2013 00:34:54 -0400 Subject: [PATCH] Clear mob health display if it gets stuck. Fixes #933 --- .../java/com/gmail/nossr50/util/skills/CombatUtils.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 8cad04087..cdff519dc 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -308,10 +308,16 @@ public final class CombatUtils { oldName = ""; } - if (!ChatColor.stripColor(oldName).equalsIgnoreCase(ChatColor.stripColor(newName))) { + boolean updateName = !ChatColor.stripColor(oldName).equalsIgnoreCase(ChatColor.stripColor(newName)); + + if (updateName) { target.setMetadata(mcMMO.customNameKey, new FixedMetadataValue(mcMMO.p, oldName)); target.setMetadata(mcMMO.customVisibleKey, new FixedMetadataValue(mcMMO.p, oldNameVisible)); } + else if (!target.hasMetadata(mcMMO.customNameKey)) { + target.setMetadata(mcMMO.customNameKey, new FixedMetadataValue(mcMMO.p, "")); + target.setMetadata(mcMMO.customVisibleKey, new FixedMetadataValue(mcMMO.p, false)); + } new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, displayTime * 20); // Clear health display after 3 seconds }