mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 18:32:24 +00:00
Fix hologram interaction in 1.8.x
This commit is contained in:
parent
6dcedc9bff
commit
198f83c738
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user