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) {
|
||||
this.target = target;
|
||||
|
||||
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() {
|
||||
if (target.isValid()) {
|
||||
target.setCustomNameVisible(oldNameVisible);
|
||||
target.setCustomName(oldName);
|
||||
target.removeMetadata(mcMMO.customNameKey, mcMMO.p);
|
||||
target.removeMetadata(mcMMO.customVisibleKey, mcMMO.p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,13 +313,11 @@ public final class CombatUtils {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason CUSTOM
|
||||
|
Loading…
Reference in New Issue
Block a user