SpectatorMenu.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:MinigameManager 作者:
public SpectatorMenu(final Minigame minigame, String[] alive, String title, ItemStack backItem, ItemStack nextItem) {
    super(minigame, title, backItem, nextItem, new EventListener<InventoryClickEvent>() {
        public void onEvent(InventoryClickEvent event) {
            ItemStack item = event.getCurrentItem();
            if (item != null && item.getType() == Material.SKULL_ITEM) {
                HumanEntity human = event.getWhoClicked();
                // only works for spectators
                if (!(human instanceof Player) || minigame.isAlive(((Player) human)))
                    return;
                SkullMeta meta = (SkullMeta) item.getItemMeta();
                Player target = Bukkit.getPlayer(meta.getOwner());
                human.teleport(target);
            }
        };
    }, getHeadsForPlayers(alive));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号