mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Remove metadata, validation checks.
This commit is contained in:
parent
7d6eb65776
commit
b82c3f41d3
@ -12,13 +12,20 @@ public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
|
|||||||
|
|
||||||
public MobHealthDisplayUpdaterTask(LivingEntity target) {
|
public MobHealthDisplayUpdaterTask(LivingEntity target) {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.oldName = target.getMetadata(mcMMO.customNameKey).get(0).asString();
|
|
||||||
this.oldNameVisible = target.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean();
|
if (target.isValid()) {
|
||||||
|
this.oldName = target.getMetadata(mcMMO.customNameKey).get(0).asString();
|
||||||
|
this.oldNameVisible = target.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
target.setCustomNameVisible(oldNameVisible);
|
if (target.isValid()) {
|
||||||
target.setCustomName(oldName);
|
target.setCustomNameVisible(oldNameVisible);
|
||||||
|
target.setCustomName(oldName);
|
||||||
|
target.removeMetadata(mcMMO.customNameKey, mcMMO.p);
|
||||||
|
target.removeMetadata(mcMMO.customVisibleKey, mcMMO.p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,9 +313,7 @@ public final class CombatUtils {
|
|||||||
target.setMetadata(mcMMO.customVisibleKey, new FixedMetadataValue(mcMMO.p, oldNameVisible));
|
target.setMetadata(mcMMO.customVisibleKey, new FixedMetadataValue(mcMMO.p, oldNameVisible));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.isValid()) {
|
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, displayTime * 20); // Clear health display after 3 seconds
|
||||||
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, displayTime * 20); // Clear health display after 3 seconds
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user