java类org.bukkit.inventory.InventoryView的实例源码

CraftHumanEntity.java 文件源码 项目:FFoKC 阅读 20 收藏 0 点赞 0 评论 0
public InventoryView openEnchanting(Location location, boolean force) {
    if (!force) {
        Block block = location.getBlock();
        if (block.getType() != Material.ENCHANTMENT_TABLE) {
            return null;
        }
    }
    if (location == null) {
        location = getLocation();
    }
    getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
CraftContainer.java 文件源码 项目:FFoKC 阅读 22 收藏 0 点赞 0 评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
    this(new InventoryView() {
        @Override
        public Inventory getTopInventory() {
            return inventory;
        }

        @Override
        public Inventory getBottomInventory() {
            return player.getInventory();
        }

        @Override
        public HumanEntity getPlayer() {
            return player;
        }

        @Override
        public InventoryType getType() {
            return inventory.getType();
        }
    }, id);
}
CraftHumanEntity.java 文件源码 项目:CraftBukkit 阅读 23 收藏 0 点赞 0 评论 0
public InventoryView openWorkbench(Location location, boolean force) {
    if (!force) {
        Block block = location.getBlock();
        if (block.getType() != Material.WORKBENCH) {
            return null;
        }
    }
    if (location == null) {
        location = getLocation();
    }
    getHandle().startCrafting(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().activeContainer.checkReachable = false;
    }
    return getHandle().activeContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码 项目:CraftBukkit 阅读 23 收藏 0 点赞 0 评论 0
public InventoryView openEnchanting(Location location, boolean force) {
    if (!force) {
        Block block = location.getBlock();
        if (block.getType() != Material.ENCHANTMENT_TABLE) {
            return null;
        }
    }
    if (location == null) {
        location = getLocation();
    }
    getHandle().startEnchanting(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
    if (force) {
        getHandle().activeContainer.checkReachable = false;
    }
    return getHandle().activeContainer.getBukkitView();
}
CraftContainer.java 文件源码 项目:CraftBukkit 阅读 23 收藏 0 点赞 0 评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
    this(new InventoryView() {
        @Override
        public Inventory getTopInventory() {
            return inventory;
        }

        @Override
        public Inventory getBottomInventory() {
            return player.getInventory();
        }

        @Override
        public HumanEntity getPlayer() {
            return player;
        }

        @Override
        public InventoryType getType() {
            return inventory.getType();
        }
    }, id);
}
BusyMenu.java 文件源码 项目:BusyInv 阅读 25 收藏 0 点赞 0 评论 0
@Override
public boolean isOpenFor(Player p)
{
    InventoryView iview = p.getOpenInventory();
    if(null == iview)
        return false;
    Inventory inv = iview.getTopInventory();
    if(null == inv)
        return false;
    InventoryHolder holder = inv.getHolder();
    if(!(holder instanceof BusyHolder))
        return false;
    IBusyMenu menu = ((BusyHolder)holder).getMenu();
    if(!menu.equals(this))
        return false;
    return true;
}
BusyMenu.java 文件源码 项目:BusyInv 阅读 22 收藏 0 点赞 0 评论 0
/**
 * If a BusyMenu is opened for the target player, this method will reload
 * the menu for the player.
 * 
 * @see {@link IBusyMenu#reload}
 * 
 * @param p
 *            Target player
 * @return true if and only if the menu is reloaded. Otherwise false(for
 *         example the player didn't open an inventory or the inventory
 *         isn't a menu)
 */
public static boolean reloadFor(Player p)
{
    InventoryView iview = p.getOpenInventory();
    if(null == iview)
        return false;
    Inventory inv = iview.getTopInventory();
    if(null == inv)
        return false;
    InventoryHolder holder = inv.getHolder();
    if(!(holder instanceof BusyHolder))
        return false;
    ((BusyHolder)holder).getMenu().updateFor(p);
    p.updateInventory();
    return true;
}
Perk.java 文件源码 项目:Breakpoint 阅读 25 收藏 0 点赞 0 评论 0
public static InventoryView showPerkMenu(BPPlayer bpPlayer)
{
    Player player = bpPlayer.getPlayer();
    List<Perk> perks = bpPlayer.getPerks();

    if(perks.size() <= 0)
    {
        player.sendMessage(MessageType.MENU_PERKS_EMPTY.getTranslation().getValue());
        return null;
    }

    int rows = bpPlayer.getPerkInventoryRows();
    Inventory inv = Bukkit.getServer().createInventory(player, 9 * rows, MENU_TITLE);

    equipMenu(bpPlayer, inv);
    player.closeInventory();

    return player.openInventory(inv);
}
InventoryManager.java 文件源码 项目:BlockParty-1.8 阅读 31 收藏 0 点赞 0 评论 0
public void clearInventory(Player p) {
    PlayerInventory inv = p.getInventory();
    inv.clear();
    inv.setHelmet(null);
    inv.setChestplate(null);
    inv.setLeggings(null);
    inv.setBoots(null);
    InventoryView view = p.getOpenInventory();
    if (view != null) {
        view.setCursor(null);
        Inventory i = view.getTopInventory();
        if (i != null) {
            i.clear();
        }
    }
}
CraftContainer.java 文件源码 项目:Uranium 阅读 31 收藏 0 点赞 0 评论 0
public CraftContainer(InventoryView view, int id) {
    this.view = view;
    this.windowId = id;
    // TODO: Do we need to check that it really is a CraftInventory?
    net.minecraft.inventory.IInventory top = ((CraftInventory)view.getTopInventory()).getInventory();
    net.minecraft.inventory.IInventory bottom = ((CraftInventory)view.getBottomInventory()).getInventory();
    cachedType = view.getType();
    cachedTitle = view.getTitle();
    cachedSize = getSize();
    setupSlots(top, bottom);
}


问题


面经


文章

微信
公众号

扫码关注公众号