Java 类org.bukkit.inventory.InventoryView 实例源码

项目:Uranium    文件:CraftHumanEntity.java   
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().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
项目:Uranium    文件:CraftHumanEntity.java   
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();
}
项目:Uranium    文件:CraftContainer.java   
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);
}
项目:ProjectAres    文件:WindowManager.java   
/**
 * Register the given {@link WindowListener} to receive notifications about the given {@link InventoryView}.
 */
public InventoryView registerWindow(WindowListener listener, InventoryView window) {
    final Player player = (Player) window.getPlayer();

    final View old = views.get(player);
    if(old == null || !old.window.equals(window)) {
        if(old != null) {
            old.notifyClose();
        }

        final View view = new View(player, window, listener);
        views.put(player, view);
        view.notifyOpen();
    }

    return window;
}
项目:RPGInventory    文件:ItemListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void afterEquipChange(final InventoryDragEvent event) {
    final Player player = (Player) event.getWhoClicked();

    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    new BukkitRunnable() {
        @Override
        public void run() {
            InventoryView inventoryView = event.getView();
            for (int slot : event.getRawSlots()) {
                ItemStack item = inventoryView.getItem(slot);
                if (CustomItem.isCustomItem(item)) {
                    ItemManager.updateStats((Player) event.getWhoClicked());
                }
            }
        }
    }.runTaskLater(RPGInventory.getInstance(), 1);
}
项目:AgarMC    文件:CellSpawner.java   
@Override
public void run() {
    AgarMC plugin = AgarMC.get();
    if (plugin.getGame().getPlayers().isEmpty())
        return ;

    if(plugin.getGame().getVirus().size() < plugin.getGame().getMaxVirus()) {
        VirusCell virus = new VirusCell(Utils.randomLocation(plugin.getGame().getOrigin().getX(), plugin.getGame().getDimensions()), Utils.randomLocation(plugin.getGame().getOrigin().getZ(), plugin.getGame().getDimensions()));
        plugin.getGame().addVirus(virus);
    }

    for (CPlayer player : plugin.getGame().getPlayers())
    {
        player.getPlayer().getInventory().setItem(1, updateColorBlock(player.getPlayer().getInventory().getItem(1)));
        InventoryView iv = player.getPlayer().getOpenInventory();
        if (iv == null)
            continue ;
        Inventory i = iv.getTopInventory();
        if (i == null || !i.getName().equals(MenuGui.INV_NAME))
            continue ;
        i.setItem(0, updateColorBlock(i.getItem(0)));
    }
}
项目:AsgardAscension    文件:AbilityListener.java   
@EventHandler
public void onRepair(InventoryClickEvent event) {
    if(event.isCancelled() || !(event.getWhoClicked() instanceof Player) || !(event.getInventory() instanceof AnvilInventory))
        return;

    InventoryView view = event.getView();
    int rawSlot = event.getRawSlot();

    if(rawSlot != view.convertSlot(rawSlot) || rawSlot != 2)
        return;

    ItemStack item = event.getInventory().getItem(0);
    if(!plugin.getAbilityManager().hasAbility(item) || !plugin.getAbilityManager().isTemporaryItem(item))
        return;

    Ability ability = plugin.getAbilityManager().getAbility(item);
    event.getInventory().setItem(0, plugin.getAbilityManager().removeItemLore(item, ability));
    event.setCancelled(true);
}
项目:ThermosRebased    文件:CraftHumanEntity.java   
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().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
项目:ThermosRebased    文件:CraftHumanEntity.java   
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();
}
项目:ThermosRebased    文件:CraftContainer.java   
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);
}
项目:Thermos-Bukkit    文件:InventoryDragEvent.java   
public InventoryDragEvent(InventoryView what, ItemStack newCursor, ItemStack oldCursor, boolean right, Map<Integer, ItemStack> slots) {
    super(what);

    Validate.notNull(oldCursor);
    Validate.notNull(slots);

    type = right ? DragType.SINGLE : DragType.EVEN;
    this.newCursor = newCursor;
    this.oldCursor = oldCursor;
    this.addedItems = slots;
    ImmutableSet.Builder<Integer> b = ImmutableSet.builder();
    for (Integer slot : slots.keySet()) {
        b.add(what.convertSlot(slot));
    }
    this.containerSlots = b.build();
}
项目:Breakpoint    文件:Perk.java   
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);
}
项目:Thermos    文件:CraftHumanEntity.java   
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().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
项目:Thermos    文件:CraftHumanEntity.java   
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();
}
项目:KCauldron    文件:CraftHumanEntity.java   
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().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
项目:KCauldron    文件:CraftHumanEntity.java   
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();
}
项目:Craftbukkit    文件:CraftContainer.java   
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);
}
项目:KCauldron    文件:CraftContainer.java   
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);
}
项目:CauldronGit    文件:InventoryDragEvent.java   
public InventoryDragEvent(InventoryView what, ItemStack newCursor, ItemStack oldCursor, boolean right, Map<Integer, ItemStack> slots) {
    super(what);

    Validate.notNull(oldCursor);
    Validate.notNull(slots);

    type = right ? DragType.SINGLE : DragType.EVEN;
    this.newCursor = newCursor;
    this.oldCursor = oldCursor;
    this.addedItems = slots;
    ImmutableSet.Builder<Integer> b = ImmutableSet.builder();
    for (Integer slot : slots.keySet()) {
        b.add(what.convertSlot(slot));
    }
    this.containerSlots = b.build();
}
项目:CauldronGit    文件:CraftHumanEntity.java   
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().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
项目:CauldronGit    文件:CraftHumanEntity.java   
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();
}
项目:CauldronGit    文件:CraftContainer.java   
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);
}
项目:Craftbukkit    文件:CraftHumanEntity.java   
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().openTileEntity(new BlockWorkbench.TileEntityContainerWorkbench(getHandle().world, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
    if (force) {
        getHandle().activeContainer.checkReachable = false;
    }
    return getHandle().activeContainer.getBukkitView();
}
项目:Cauldron-Old    文件:CraftHumanEntity.java   
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().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
项目:Cauldron-Old    文件:CraftHumanEntity.java   
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();
}
项目:Cauldron-Old    文件:CraftContainer.java   
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);
}
项目:Cauldron-Reloaded    文件:CraftHumanEntity.java   
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().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
项目:Cauldron-Reloaded    文件:CraftHumanEntity.java   
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();
}
项目:Cauldron-Reloaded    文件:CraftContainer.java   
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);
}
项目:FFoKC    文件:CraftHumanEntity.java   
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().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
项目:FFoKC    文件:CraftHumanEntity.java   
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();
}
项目:FFoKC    文件:CraftContainer.java   
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);
}
项目:CraftBukkit    文件:CraftHumanEntity.java   
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();
}
项目:CraftBukkit    文件:CraftHumanEntity.java   
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();
}
项目:CraftBukkit    文件:CraftContainer.java   
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);
}
项目:BusyInv    文件:BusyMenu.java   
@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;
}
项目:BusyInv    文件:BusyMenu.java   
/**
 * 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;
}
项目:Breakpoint    文件:Perk.java   
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);
}
项目:BlockParty-1.8    文件:InventoryManager.java   
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();
        }
    }
}
项目:Uranium    文件:CraftContainer.java   
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);
}