mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Added health display for mobs during combat.
During combat, players will now see a healthbar appear over the head of hostile mobs when they are damaged. This healthbar will have two display options - HEARTS and BAR - which can be changed via the /mobhealth command. New Permissions: mcmmo.mobhealthdisplay - Allows viewing of mob health display mcmmo.commands.mobhealth - Allows access to the /mobhealth command New Config Options (config.yml): Mob_Healthbar.Display_Type - the default health display type Mob_Healthbar.Display_Time - the amount of time to show health display
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
|
||||
private LivingEntity target;
|
||||
private String oldName;
|
||||
private boolean oldNameVisible;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
target.setCustomNameVisible(oldNameVisible);
|
||||
target.setCustomName(oldName);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user