mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
27 lines
863 B
Java
27 lines
863 B
Java
package com.gmail.nossr50.runnables;
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
import org.bukkit.entity.LivingEntity;
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
|
|
|
public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
|
|
private LivingEntity target;
|
|
|
|
public MobHealthDisplayUpdaterTask(LivingEntity target) {
|
|
this.target = target;
|
|
}
|
|
|
|
@Override
|
|
public void run() {
|
|
if (target.hasMetadata(mcMMO.customNameKey)) {
|
|
target.setCustomName(target.getMetadata(mcMMO.customNameKey).get(0).asString());
|
|
target.removeMetadata(mcMMO.customNameKey, mcMMO.p);
|
|
}
|
|
|
|
if (target.hasMetadata(mcMMO.customVisibleKey)) {
|
|
target.setCustomNameVisible(target.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean());
|
|
target.removeMetadata(mcMMO.customVisibleKey, mcMMO.p);
|
|
}
|
|
}
|
|
}
|