mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Remove metadata, validation checks.
This commit is contained in:
@ -12,13 +12,20 @@ public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
|
||||
|
||||
public MobHealthDisplayUpdaterTask(LivingEntity 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
|
||||
public void run() {
|
||||
target.setCustomNameVisible(oldNameVisible);
|
||||
target.setCustomName(oldName);
|
||||
if (target.isValid()) {
|
||||
target.setCustomNameVisible(oldNameVisible);
|
||||
target.setCustomName(oldName);
|
||||
target.removeMetadata(mcMMO.customNameKey, mcMMO.p);
|
||||
target.removeMetadata(mcMMO.customVisibleKey, mcMMO.p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user