From a2a0de7445dd3ddac9b2d81cb57dd1cd71df902d Mon Sep 17 00:00:00 2001 From: Brianna Date: Mon, 14 Oct 2019 19:44:19 -0400 Subject: [PATCH] Fixed hologram height issue on full blocks. --- .../java/com/songoda/epicanchors/EpicAnchors.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/songoda/epicanchors/EpicAnchors.java b/src/main/java/com/songoda/epicanchors/EpicAnchors.java index 95a293b..5b60ba9 100644 --- a/src/main/java/com/songoda/epicanchors/EpicAnchors.java +++ b/src/main/java/com/songoda/epicanchors/EpicAnchors.java @@ -20,6 +20,7 @@ import com.songoda.epicanchors.utils.Methods; import org.apache.commons.lang.math.NumberUtils; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.PluginManager; @@ -122,7 +123,7 @@ public class EpicAnchors extends SongodaPlugin { } public void clearHologram(Anchor anchor) { - HologramManager.removeHologram(anchor.getLocation()); + HologramManager.removeHologram(correctHeight(anchor.getLocation())); } public void updateHologram(Anchor anchor) { @@ -132,8 +133,15 @@ public class EpicAnchors extends SongodaPlugin { if (anchor.getLocation().getBlock().getType() != Settings.MATERIAL.getMaterial().getMaterial()) return; // grab the name String name = Methods.formatName(anchor.getTicksLeft(), false).trim(); + Location location = correctHeight(anchor.getLocation()); // create the hologram - HologramManager.updateHologram(anchor.getLocation(), name); + HologramManager.updateHologram(location, name); + } + + private Location correctHeight(Location location) { + if (location.getBlock().getType() != CompatibleMaterial.END_PORTAL_FRAME.getMaterial()) + location.add(0, .05, 0); + return location; } private void loadAnchorsFromFile() {