public HoloAPI getHoloAPI() {
Plugin plugin = this.getServer().getPluginManager().getPlugin("HoloAPI");
if (plugin == null || !(plugin instanceof HoloAPI)) {
// HoloAPI isn't installed (or loaded) on this server - nag the server owner about this
return null;
}
return ((HoloAPI) plugin);
}
@EventHandler
public void onDamage (EntityDamageEvent event) {
final Location loc = new Location(event.getEntity().getWorld(), event.getEntity().getLocation().getX(), event.getEntity().getLocation().getY() + 1.4, event.getEntity().getLocation().getZ());
final Hologram DIndicator = new HologramFactory(this) // Replace "myPlugin" with your plugin instance
.withLocation(new Vector(loc.getX(), loc.getY(), loc.getZ()), "World")
.withText(ChatColor.GOLD + Integer.toString((int) event.getDamage()))
.build();
//DIndicator.show((Player) event.getDamager());
BukkitRunnable runnabledel = new BukkitRunnable() {
@Override
public void run() {
DIndicator.clearAllPlayerViews();
}
};
runnabledel.runTaskLater(this, 15L);
BukkitRunnable runnablemove = new BukkitRunnable() {
@Override
public void run() {
DIndicator.move(loc);
}
};
loc.setY(loc.getY() + 0.1);
runnablemove.runTaskLater(this, 10L);
}
@EventHandler
public void onRegen (EntityRegainHealthEvent event) {
final Location loc = new Location(event.getEntity().getWorld(), event.getEntity().getLocation().getX(), event.getEntity().getLocation().getY() + 1.4, event.getEntity().getLocation().getZ());
final Hologram DIndicator = new HologramFactory(this) // Replace "myPlugin" with your plugin instance
.withLocation(new Vector(loc.getX(), loc.getY(), loc.getZ()), "World")
.withText(ChatColor.GREEN + Integer.toString((int) event.getAmount()))
.build();
//DIndicator.show((Player) event.getDamager());
BukkitRunnable runnabledel = new BukkitRunnable() {
@Override
public void run() {
DIndicator.clearAllPlayerViews();
DIndicator.refreshDisplay();
}
};
runnabledel.runTaskLater(this, 15L);
BukkitRunnable runnablemove = new BukkitRunnable() {
@Override
public void run() {
DIndicator.move(loc);
DIndicator.refreshDisplay();
}
};
loc.setY(loc.getY() + 0.1);
runnablemove.runTaskLater(this, 10L);
}