2013-04-05 04:11:11 +02:00
|
|
|
package com.gmail.nossr50.runnables;
|
|
|
|
|
2019-01-15 07:11:58 +01:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2013-04-05 04:11:11 +02:00
|
|
|
import org.bukkit.entity.LivingEntity;
|
|
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
|
|
|
|
|
|
|
public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
|
|
|
|
private LivingEntity target;
|
|
|
|
|
|
|
|
public MobHealthDisplayUpdaterTask(LivingEntity target) {
|
2019-12-31 13:16:12 +01:00
|
|
|
this.target = target;
|
2013-04-05 04:11:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run() {
|
2019-12-31 13:16:12 +01:00
|
|
|
if (target.hasMetadata(mcMMO.customNameKey)) {
|
|
|
|
target.setCustomName(target.getMetadata(mcMMO.customNameKey).get(0).asString());
|
2013-04-08 06:24:38 +02:00
|
|
|
target.removeMetadata(mcMMO.customNameKey, mcMMO.p);
|
2019-12-31 13:16:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (target.hasMetadata(mcMMO.customVisibleKey)) {
|
|
|
|
target.setCustomNameVisible(target.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean());
|
2013-04-08 06:24:38 +02:00
|
|
|
target.removeMetadata(mcMMO.customVisibleKey, mcMMO.p);
|
|
|
|
}
|
2013-04-05 04:11:11 +02:00
|
|
|
}
|
|
|
|
}
|