diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index ab4961d..26e6298 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -341,7 +341,7 @@ public class ShopInteractListener implements Listener { Entity entity = e.getRightClicked(); Player p = e.getPlayer(); - if (e.getHand() == EquipmentSlot.HAND) { + if (Utils.getMajorVersion() == 8 || e.getHand() == EquipmentSlot.HAND) { if (entity instanceof ArmorStand) { ArmorStand armorStand = (ArmorStand) entity; if (Hologram.isPartOfHologram(armorStand)) { @@ -355,7 +355,7 @@ public class ShopInteractListener implements Listener { } if (b != null) { - PlayerInteractEvent interactEvent = new PlayerInteractEvent(p, Action.RIGHT_CLICK_BLOCK, Utils.getPreferredItemInHand(p), b, null, EquipmentSlot.HAND); + PlayerInteractEvent interactEvent = new PlayerInteractEvent(p, Action.RIGHT_CLICK_BLOCK, Utils.getPreferredItemInHand(p), b, null); handleInteractEvent(interactEvent, false); } @@ -388,8 +388,9 @@ public class ShopInteractListener implements Listener { } if (b != null) { - PlayerInteractEvent interactEvent = new PlayerInteractEvent(p, Action.LEFT_CLICK_BLOCK, Utils.getPreferredItemInHand(p), b, null, EquipmentSlot.HAND); + PlayerInteractEvent interactEvent = new PlayerInteractEvent(p, Action.LEFT_CLICK_BLOCK, Utils.getPreferredItemInHand(p), b, null); handleInteractEvent(interactEvent, false); + e.setCancelled(true); } } diff --git a/src/main/java/de/epiceric/shopchest/nms/Hologram.java b/src/main/java/de/epiceric/shopchest/nms/Hologram.java index d70dd5b..60903b1 100644 --- a/src/main/java/de/epiceric/shopchest/nms/Hologram.java +++ b/src/main/java/de/epiceric/shopchest/nms/Hologram.java @@ -64,7 +64,7 @@ public class Hologram { } else { if (plugin.getShopChestConfig().enable_hologram_interaction) { loc = location.clone(); - loc.add(0, 1, 0); + loc.add(0, 0.4, 0); } else { continue; } @@ -90,10 +90,10 @@ public class Hologram { entityArmorStandClass.getMethod("setNoGravity", boolean.class).invoke(entityArmorStand, true); } - // Probably like an addEntity() method... - Method b = nmsWorldServer.getClass().getDeclaredMethod("b", entityClass); - b.setAccessible(true); - b.invoke(nmsWorldServer, entityArmorStand); + // Adds the entity to some lists so it can call interact events + Method addEntityMethod = nmsWorldServer.getClass().getDeclaredMethod((Utils.getMajorVersion() == 8 ? "a" : "b"), entityClass); + addEntityMethod.setAccessible(true); + addEntityMethod.invoke(nmsWorldServer, entityArmorStand); Object uuid = entityClass.getMethod("getUniqueID").invoke(entityArmorStand);