本文整理了Java中org.bukkit.inventory.Inventory.all()
方法的一些代码示例,展示了Inventory.all()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inventory.all()
方法的具体详情如下:
包路径:org.bukkit.inventory.Inventory
类名称:Inventory
方法名:all
[英]Returns a HashMap with all slots and ItemStacks in the inventory with given materialId.
The HashMap contains entries where, the key is the slot index, and the value is the ItemStack in that slot. If no matching ItemStack with the given materialId is found, an empty map is returned.
[中]返回一个HashMap,其中包含给定materialId的库存中的所有插槽和项目堆栈。
HashMap包含条目,其中,键是插槽索引,值是该插槽中的ItemStack。如果找不到与给定materialId匹配的ItemStack,则返回空映射。
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
@SuppressWarnings("unchecked")
public HashMap<Integer, ItemStack> all(ItemStack item) {
return (HashMap<Integer, ItemStack>) base.all(item);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
@SuppressWarnings("unchecked")
public HashMap<Integer, ItemStack> all(Material material) {
return (HashMap<Integer, ItemStack>) base.all(material);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
@SuppressWarnings("unchecked")
public HashMap<Integer, ItemStack> all(int materialId) {
return (HashMap<Integer, ItemStack>) base.all(materialId);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public HashMap<Integer, ? extends ItemStack> all(int materialId) {
return base.all(materialId);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public HashMap<Integer, ? extends ItemStack> all(Material material) {
return base.all(material);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public HashMap<Integer, ? extends ItemStack> all(ItemStack item) {
return base.all(item);
}
代码示例来源:origin: catageek/ByteCart
private static String getRawContent(Inventory inv, String name) {
int bookcount = inv.all(Material.WRITTEN_BOOK).size();
int len = bookcount * BookFile.MAXSIZE;
StringBuilder sb = new StringBuilder(len);
for (int i = 0; i < bookcount; ++i) {
final BookInputStream bookInputStream = getBookInputStream(inv, i, name);
if (bookInputStream != null) {
sb.append(bookInputStream.getBuffer());
}
}
sb.trimToSize();
return sb.toString();
}
代码示例来源:origin: PyvesB/AdvancedAchievements
/**
* Verifies whether the user has clicked on the given navigation button.
*
* @param event
* @param button
* @return true if the button is clicked, false otherwise
*/
private boolean isButtonClicked(InventoryClickEvent event, ItemStack button) {
if (event.getCurrentItem().isSimilar(button)) {
// Clicked item seems to be the button. But player could have clicked on item in his personal inventory that
// matches the properties of the button used by Advanced Achievements. The first item matching the
// properties of the button is the real one, check that this is indeed the clicked one.
Map<Integer, ItemStack> backButtonCandidates = new TreeMap<>(
event.getInventory().all(event.getCurrentItem().getType()));
for (Entry<Integer, ItemStack> entry : backButtonCandidates.entrySet()) {
if (event.getCurrentItem().isSimilar(entry.getValue())) {
// Found real button. Did the player click on it?
if (entry.getKey() == event.getRawSlot()) {
return true;
}
break;
}
}
}
return false;
}
代码示例来源: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
bagId = qf.doSyncInsert("paper_bag", bag);
HashMap<Integer, ItemStack> babies = (HashMap<Integer, ItemStack>) inv.all(Material.MELON_SLICE);
HashMap<Integer, Integer> adjustments = new HashMap<>();
for (Map.Entry<Integer, ItemStack> entry : babies.entrySet()) {
内容来源于网络,如有侵权,请联系作者删除!