@EventHandler
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent e) {
if (!plugin.getShopChestConfig().enable_hologram_interaction) return;
Entity entity = e.getRightClicked();
Player p = e.getPlayer();
if (config.enable_authme_integration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(p)) return;
if (Utils.getMajorVersion() == 8 || e.getHand() == EquipmentSlot.HAND) {
if (entity instanceof ArmorStand) {
ArmorStand armorStand = (ArmorStand) entity;
if (Hologram.isPartOfHologram(armorStand)) {
Hologram hologram = Hologram.getHologram(armorStand);
if (hologram != null) {
Block b = null;
for (Shop shop : plugin.getShopUtils().getShops()) {
if (shop.getHologram() != null && shop.getHologram().equals(hologram)) {
b = shop.getLocation().getBlock();
}
}
if (b != null) {
PlayerInteractEvent interactEvent = new PlayerInteractEvent(p, Action.RIGHT_CLICK_BLOCK, Utils.getPreferredItemInHand(p), b, null);
handleInteractEvent(interactEvent);
}
}
}
}
}
}
ShopInteractListener.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:ShopChest
作者:
评论列表
文章目录