本文整理了Java中org.bukkit.inventory.Inventory.contains()
方法的一些代码示例,展示了Inventory.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inventory.contains()
方法的具体详情如下:
包路径:org.bukkit.inventory.Inventory
类名称:Inventory
方法名:contains
[英]Checks if the inventory contains any ItemStacks with the given materialId
[中]检查库存是否包含任何具有给定materialId的ItemStack
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(Material material) {
return base.contains(material);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(ItemStack item) {
return base.contains(item);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(int materialId, int amount) {
return base.contains(materialId, amount);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(int materialId) {
return base.contains(materialId);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(Material material, int amount) {
return base.contains(material, amount);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(Material material) {
return base.contains(material);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(int materialId, int amount) {
return base.contains(materialId, amount);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(int materialId) {
return base.contains(materialId);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(ItemStack item) {
return base.contains(item);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(Material material, int amount) {
return base.contains(material, amount);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(ItemStack item, int amount) {
return base.contains(item, amount);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean contains(ItemStack item, int amount) {
return base.contains(item, amount);
}
代码示例来源:origin: eccentricdevotion/TARDIS
private boolean checkSlots(Inventory inv) {
boolean check = false;
int count = 0;
for (int i = 1; i < 10; i++) {
if (inv.getItem(i) != null && !inv.getItem(i).getType().equals(Material.AIR)) {
count++;
}
}
if ((inv.contains(Material.MUSIC_DISC_CAT) || inv.contains(Material.MUSIC_DISC_MALL)) && count > 1) {
check = true;
}
return check;
}
代码示例来源:origin: catageek/ByteCart
/**
* Get a slot containing a ticket
*
*
* @param inv The inventory to search in
* @return a slot number, or -1
*/
static int getTicketslot(Inventory inv) {
if (inv.contains(Material.WRITTEN_BOOK)) {
// priority given to book in hand
if (inv instanceof PlayerInventory) {
if (isTicket(((PlayerInventory) inv).getItemInMainHand())) {
return ((PlayerInventory) inv).getHeldItemSlot();
}
}
ListIterator<ItemStack> it = inv.iterator();
while (it.hasNext()) {
if (isTicket(it.next()))
return it.previousIndex();
}
}
return -1;
}
代码示例来源:origin: catageek/ByteCart
&& inv.contains(Material.WRITABLE_BOOK)) {
代码示例来源:origin: ChestShop-authors/ChestShop-3
/**
* Returns the amount of the item inside the inventory
*
* @param item Item to check
* @param inventory inventory
* @return amount of the item
*/
public static int getAmount(ItemStack item, Inventory inventory) {
if (!inventory.contains(item.getType())) {
return 0;
}
if (inventory.getType() == null) {
return Integer.MAX_VALUE;
}
HashMap<Integer, ? extends ItemStack> items = inventory.all(item.getType());
int itemAmount = 0;
for (ItemStack iStack : items.values()) {
if (!MaterialUtil.equals(iStack, item)) {
continue;
}
itemAmount += iStack.getAmount();
}
return itemAmount;
}
代码示例来源:origin: eccentricdevotion/TARDIS
if (inv.contains(Material.MUSIC_DISC_CAT)) {
代码示例来源:origin: eccentricdevotion/TARDIS
tcc.getCircuits();
if (!tcc.hasMaterialisation() && (inv.contains(Material.MUSIC_DISC_CAT) || inv.contains(Material.MUSIC_DISC_BLOCKS) || inv.contains(Material.MUSIC_DISC_CHIRP) || inv.contains(Material.MUSIC_DISC_WAIT))) {
TARDISMessage.send(p, "MAT_MISSING");
return;
代码示例来源:origin: TheBusyBiscuit/Slimefun4
if (chamber.getInventory().contains(Material.FLINT_AND_STEEL)) {
ItemStack item = chamber.getInventory().getItem(chamber.getInventory().first(Material.FLINT_AND_STEEL));
item.setDurability((short) (item.getDurability() + 1));
内容来源于网络,如有侵权,请联系作者删除!