org.bukkit.inventory.Inventory.containsAtLeast()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.bukkit.inventory.Inventory.containsAtLeast()方法的一些代码示例,展示了Inventory.containsAtLeast()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inventory.containsAtLeast()方法的具体详情如下:
包路径:org.bukkit.inventory.Inventory
类名称:Inventory
方法名:containsAtLeast

Inventory.containsAtLeast介绍

[英]Checks if the inventory contains ItemStacks matching the given ItemStack whose amounts sum to at least the minimum amount specified.
[中]检查库存是否包含与给定ItemStack匹配的ItemStack,其金额总和至少为指定的最小金额。

代码示例

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public boolean containsAtLeast(ItemStack item, int amount) {
  return base.containsAtLeast(item, amount);
}

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public boolean containsAtLeast(ItemStack item, int amount) {
  return base.containsAtLeast(item, amount);
}

代码示例来源:origin: ChestShop-authors/ChestShop-3

private static int getStackAmount(ItemStack item, Inventory inventory, Player player, Action action) {
  Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
  Inventory checkedInventory = (action == buy ? inventory : player.getInventory());
  if (checkedInventory.containsAtLeast(item, InventoryUtil.getMaxStackSize(item))) {
    return InventoryUtil.getMaxStackSize(item);
  } else {
    return InventoryUtil.getAmount(item, checkedInventory);
  }
}

代码示例来源:origin: TheBusyBiscuit/Slimefun4

if (d.getInventory().containsAtLeast(e.getItem(), 2)) d.getInventory().removeItem(new CustomItem(e.getItem(), 1));
  else {
    Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new BukkitRunnable() {
if (d.getInventory().containsAtLeast(e.getItem(), 2)) d.getInventory().removeItem(new CustomItem(e.getItem(), 1));
else {
  Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new BukkitRunnable() {

代码示例来源:origin: TheBusyBiscuit/Slimefun4

else if (p.getEnderChest().containsAtLeast(((Talisman) talisman).upgrade(), 1)) {
  if (Slimefun.hasUnlocked(p, ((Talisman) talisman).upgrade(), true)) {
    if (((Talisman) talisman).isConsumable()) p.getEnderChest().removeItem(((Talisman) talisman).upgrade());

相关文章