Example #1
0
  @Override
  public String toString() {
    if (method == PaymentMethod.iConomy) {
      return String.valueOf(money);
    } else if (method == PaymentMethod.Blocks) {
      StringBuilder builder = new StringBuilder();

      for (Item item : items) {
        if (builder.length() > 0) {
          builder.append(", ");
        }

        if (item.getAmount() > 1) {
          builder.append(item.getAmount());
          builder.append("* ");
        }

        builder.append(etc.getDataSource().getItem(item.getItemId()));
      }

      return builder.toString();
    } else {
      return "None";
    }
  }
Example #2
0
 /**
  * @param p - The player buying an item.
  * @param item - The item the player wants to buy.
  */
 public static void buyItem(Player p, Item item) {
   String key = item.getItemId() + ":" + item.getDamage();
   int amount = ITEMS.getInt(key, 0);
   if (amount == -1) {
     p.sendMessage(WShop.PRE + "The server does not sell that item at this time.");
     return;
   }
   if (amount < item.getAmount()) {
     p.sendMessage(WShop.PRE + "The server does not have that much of " + key);
     return;
   } // end if
   double price = PRICES.getDouble(key + "_buy", -1);
   if (price == -1) {
     p.sendMessage(WShop.PRE + "The server does not sell that item at this time." + key);
     return;
   }
   if (canPay(p, price)) {
     payPlayer(p, -price); // Make sure we charge them here, not pay them. Negate the price.
     p.giveItem(item);
     ITEMS.setInt(key, amount - item.getAmount());
     p.sendMessage(
         WShop.PRE
             + "Bought an item. ID:"
             + item.getItemId()
             + ", Damage:"
             + item.getDamage()
             + ", Amount:"
             + item.getAmount()
             + ", Cost:"
             + price);
   } else {
     p.sendMessage(WShop.PRE + "You do not have enough money to buy " + key);
     return;
   }
 } // end buyItem
Example #3
0
 public void createGroundItem(Location location, Item item) {
   for (FloorItem fi : items) {
     if (fi.getPlayer() == null
         && !fi.isDestroyed()
         && !fi.isSpawn()
         && fi.getLocation().equals(location)
         && fi.getId() == item.getId()) {
       fi.incrementAmount(item.getAmount());
       fi.resetDroppedAt();
       refresh(fi);
       return;
     }
   }
   final FloorItem floor = FloorItem.createGlobalDroppedItem(location, item);
   items.add(floor);
   refresh(floor);
   World.getInstance()
       .registerEvent(
           new Event(60000) {
             @Override
             public void execute() {
               long diff = System.currentTimeMillis() - floor.getDroppedAt();
               if (diff >= 60000) {
                 items.remove(floor);
                 floor.setDestroyed(true);
                 refresh(floor);
                 this.stop();
               } else {
                 this.setTick((int) diff);
               }
             }
           });
 }
  /**
   * Removes the item. No slot needed, it will go through the inventory until the amount specified
   * is removed.
   *
   * @param id item to remove
   * @param amount amount to remove
   */
  public void removeItem(int id, int amount) {
    Item[] items = getContents();

    for (Item item : items) {
      if ((item != null) && (item.getItemId() == id)) {
        if (item.getAmount() == amount) {
          removeItem(item.getSlot());
          return;
        } else if (item.getAmount() > amount) {
          setSlot(id, item.getAmount() - amount, item.getSlot());
          amount -= item.getAmount();
        } else {
          removeItem(item.getSlot());
          amount -= item.getAmount();
        }
      }
    }
  }
  /**
   * Retrieves from the slot
   *
   * @param id
   * @param maxAmount
   * @return item
   */
  public Item getItemFromId(int id, int maxAmount) {
    Item[] items = getContents();

    for (Item item : items) {
      if ((item != null) && (item.getItemId() == id) && (item.getAmount() <= maxAmount)) {
        return item;
      }
    }

    return null;
  }
  /**
   * Checks to see if this getArray() has one slot that has the item id and equal or more to the
   * amount.
   *
   * @param itemId item to look for
   * @param minimum amount of items that must be in the stack
   * @return
   */
  public boolean hasItem(int itemId, int minimum) {
    Item[] items = getContents();

    for (Item item : items) {
      if ((item != null) && (item.getItemId() == itemId) && (item.getAmount() >= minimum)) {
        return true;
      }
    }

    return false;
  }
  /**
   * Adds the specified item. If the item doesn't have a slot, it will get the nearest available
   * slot. If amount is equal to 0, it will delete the item if a slot is specified.
   *
   * @param item item to add
   */
  public void addItem(Item item) {
    if (item == null) {
      return;
    }

    int slot = item.getSlot();
    if (slot < _getArray().length && slot >= 0) {
      if (item.getAmount() <= 0) {
        _getArray()[slot] = null;
      } else if (Item.isValidItem(item.getItemId())) {
        _getArray()[slot] = new hn(item.getItemId(), item.getAmount());
      }
    } else if (slot == -1) {
      int newSlot = getEmptySlot();
      if (newSlot != -1) {
        _getArray()[newSlot] = new hn(item.getItemId(), item.getAmount());
        item.setSlot(newSlot);
      }
    }
  }
  /**
   * Checks to see if this getArray() has one slot that has the item id and equal or more to the
   * amount.
   *
   * @param type item to look for
   * @param minimum amount of items that must be in the stack
   * @return
   */
  public boolean hasItem(Item.Type type, int minimum) {
    Item[] items = getContents();

    for (Item item : items) {
      if ((item != null) && (item.getType() == type) && (item.getAmount() >= minimum)) {
        return true;
      }
    }

    return false;
  }
Example #9
0
 /**
  * @param p - The player trying to sell.
  * @param item - The item to sell, commonly the players help item.
  */
 public static void sellItem(Player p, Item item) {
   String key = item.getItemId() + ":" + item.getDamage();
   double price = PRICES.getDouble(key + "_sell", -1);
   if (price == -1) {
     p.sendMessage(WShop.PRE + "The server does not buy that item at this time.");
     return;
   }
   int amount = ITEMS.getInt(key, 0);
   p.getInventory().removeItem(item);
   ITEMS.setInt(key, amount + item.getAmount());
   payPlayer(p, price);
   return;
 } // end sellItem
Example #10
0
  private boolean deductBlocks(Player player) {
    Inventory inventory = player.getInventory();

    for (Item item : items) {
      if (inventory.hasItem(item.getItemId(), item.getAmount(), 65)) {
        inventory.removeItem(item);
        inventory.update();
        return true;
      }
    }

    return false;
  }
  /**
   * Month conversion from entity object to jaxb model.
   *
   * @param data month entity object
   * @return jaxb model of month
   */
  public static Month transformMonthToModel(org.kaleta.scheduler.backend.entity.Month data) {
    Month model = new Month();

    model.setId(String.valueOf(data.getId()));

    Month.Specification specification = new Month.Specification();
    specification.setName(data.getName());
    specification.setDays(String.valueOf(data.getDaysNumber()));
    specification.setFirstDay(String.valueOf(data.getDayStartsWith()));
    for (Integer day : data.getPublicFreeDays()) {
      Month.Specification.FreeDay freeDay = new Month.Specification.FreeDay();
      freeDay.setDay(String.valueOf(day));
      specification.getFreeDayList().add(freeDay);
    }
    model.setSpecification(specification);

    Month.Schedule schedule = new Month.Schedule();
    for (Task task : data.getTasks()) {
      Month.Schedule.Task taskModel = new Month.Schedule.Task();
      taskModel.setId(String.valueOf(task.getId()));
      taskModel.setType(task.getType());
      taskModel.setDescription(task.getDescription());
      taskModel.setDay(String.valueOf(task.getDay()));
      taskModel.setStarts(task.getStarts().toString());
      taskModel.setDuration(task.getDuration().toString());
      taskModel.setPriority(String.valueOf(task.getPriority()));
      taskModel.setSuccessful(String.valueOf(task.getSuccessful()));
      schedule.getTaskList().add(taskModel);
    }
    model.setSchedule(schedule);

    Month.Accounting accounting = new Month.Accounting();
    for (Item item : data.getItems()) {
      Month.Accounting.Item itemModel = new Month.Accounting.Item();
      itemModel.setId(String.valueOf(item.getId()));
      itemModel.setType(item.getType());
      itemModel.setDescription(item.getDescription());
      itemModel.setDay(String.valueOf(item.getDay()));
      itemModel.setIncome(String.valueOf(item.getIncome()));
      itemModel.setAmount(String.valueOf(item.getAmount()));
      accounting.getItemList().add(itemModel);
    }
    model.setAccounting(accounting);

    return model;
  }
Example #12
0
 @Override
 public void run(String playerID) {
   Player player = PlayerConverter.getPlayer(playerID);
   for (Item theItem : questItems) {
     QuestItem questItem = theItem.getItem();
     int amount = theItem.getAmount();
     if (notify) {
       player.sendMessage(
           Config.getMessage("items_given")
               .replaceAll(
                   "%name%",
                   (questItem.getName() != null)
                       ? questItem.getName()
                       : questItem.getMaterial().toString())
               .replaceAll("%amount%", String.valueOf(amount))
               .replaceAll("&", "§"));
     }
     while (amount > 0) {
       int stackSize;
       if (amount > 64) {
         stackSize = 64;
       } else {
         stackSize = amount;
       }
       ItemStack item = questItem.generateItem(stackSize);
       HashMap<Integer, ItemStack> left = player.getInventory().addItem(item);
       for (Integer leftNumber : left.keySet()) {
         ItemStack itemStack = left.get(leftNumber);
         if (Utils.isQuestItem(itemStack)) {
           BetonQuest.getInstance().getDBHandler(playerID).addItem(itemStack, stackSize);
         } else {
           player.getWorld().dropItem(player.getLocation(), itemStack);
         }
       }
       amount = amount - stackSize;
     }
   }
 }
Example #13
0
  /*
   * M4411K4: redoing code here because the last code from
   * I guess sk89q, didn't work properly and used more resources
   * than should have (using exceptions to break? o_O)
   */
  public static void moveChestBagToItemArray(
      ItemArray<?> to, NearbyChestBlockBag bag, int itemType, int itemColor, int itemAmount) {

    Item[] toItems = to.getContents();
    Inventory[] bags = bag.getInventories();
    boolean changed = false;
    int currentAmount = 0;

    for (int toSlot = 0; toSlot < toItems.length; toSlot++) {
      Item toItem = toItems[toSlot];
      int maxStack = 0;
      if (toItem != null) {
        maxStack = getStackMax(toItem);
        if (toItem.getAmount() >= maxStack
            || (itemType > 0
                && (itemType != toItem.getItemId()
                    || (itemColor != -1 && itemColor != toItem.getDamage())))) {
          continue;
        }
      }

      boolean moved = false;

      for (Inventory inventory : bags) {
        Item[] chestItems = inventory.getContents();
        for (int chestSlot = 0; chestSlot < chestItems.length; chestSlot++) {
          Item chestItem = chestItems[chestSlot];
          if (chestItem == null
              || chestItem.getAmount() == 0
              || (toItem != null
                  && (chestItem.getItemId() != toItem.getItemId()
                      || chestItem.getDamage() != toItem.getDamage()))
              || (itemType > 0
                  && (itemType != chestItem.getItemId()
                      || (itemColor != -1 && itemColor != chestItem.getDamage())))) {
            // empty or not the same item so move on to next slot
            continue;
          }

          currentAmount += chestItem.getAmount();
          Item itemCopy = null;
          if (itemAmount > 0 && currentAmount > itemAmount) {
            itemCopy =
                new Item(
                    chestItem.getItemId(),
                    currentAmount - itemAmount,
                    chestItem.getSlot(),
                    chestItem.getDamage());

            chestItem.setAmount(chestItem.getAmount() - itemCopy.getAmount());
          }

          // can move to slot
          if (toItem == null) {
            toItems[toSlot] = chestItem;
            chestItems[chestSlot] = null;
          } else {
            // maxStack should have correct value since toItem is not null
            int spaceAvailable = maxStack - toItem.getAmount();
            if (spaceAvailable >= chestItem.getAmount()) {
              // everything fits
              toItem.setAmount(toItem.getAmount() + chestItem.getAmount());
              chestItems[chestSlot] = null;
            } else {
              // doesn't fit into slot
              toItem.setAmount(maxStack);
              chestItem.setAmount(chestItem.getAmount() - spaceAvailable);
            }
          }

          // if not max, re-check slot
          maxStack = getStackMax(toItems[toSlot]);
          if (toItems[toSlot].getAmount() < maxStack) {
            toSlot--;
          }

          if (itemCopy != null) {
            if (chestItems[chestSlot] != null) {
              itemCopy.setAmount(itemCopy.getAmount() + chestItems[chestSlot].getAmount());
            }

            chestItems[chestSlot] = itemCopy;
          }

          moved = true;
          changed = true;
          break;
        }

        if (moved || (itemAmount > 0 && currentAmount >= itemAmount)) {
          // set chest items with new values
          setContents(inventory, chestItems);

          // go to next item slot
          break;
        }
      }

      if (itemAmount > 0 && currentAmount >= itemAmount) {
        break;
      }
    }

    if (changed) {
      setContents(to, toItems);
    }
  }
 /**
  * Removes the item. No slot needed, it will go through the inventory until the amount specified
  * is removed.
  *
  * @param item item id and amount to remove
  */
 public void removeItem(Item item) {
   removeItem(item.getItemId(), item.getAmount());
 }
 /**
  * Sets the specified slot with item
  *
  * @param item item to set
  * @param slot slot to use
  */
 public void setSlot(Item item, int slot) {
   setSlot(item.getItemId(), item.getAmount(), slot);
 }
Example #16
0
  public static void moveItemArrayToChestBag(
      ItemArray<?> from, NearbyChestBlockBag bag, int itemType, int itemColor, int itemAmount) {

    Item[] fromItems = from.getContents();
    Inventory[] inventories = bag.getInventories();
    int invenIndex = 0;
    boolean changed = false;

    int currentAmount = 0;

    try {
      for (int cartSlot = 0; cartSlot < fromItems.length; cartSlot++) {
        Item cartItem = fromItems[cartSlot];

        if (cartItem == null
            || cartItem.getAmount() == 0
            || (itemType > 0
                && (itemType != cartItem.getItemId()
                    || (itemColor != -1 && itemColor != cartItem.getDamage())))) {
          continue;
        }

        currentAmount += cartItem.getAmount();
        Item itemCopy = null;

        if (itemAmount > 0 && currentAmount > itemAmount) {
          itemCopy =
              new Item(
                  cartItem.getItemId(),
                  currentAmount - itemAmount,
                  cartItem.getSlot(),
                  cartItem.getDamage());

          cartItem.setAmount(cartItem.getAmount() - itemCopy.getAmount());
        }

        try {
          for (; invenIndex < inventories.length; invenIndex++) {
            Item[] chestItems = inventories[invenIndex].getContents();

            for (int chestSlot = 0; chestSlot < chestItems.length; chestSlot++) {
              Item chestItem = chestItems[chestSlot];

              if (chestItem == null) {
                chestItems[chestSlot] = cartItem;
                fromItems[cartSlot] = null;
                setContents(inventories[invenIndex], chestItems);
                changed = true;
                throw new TransferredItemException();
              } else {

                int maxStack = getStackMax(chestItem);

                if (chestItem.getItemId() == cartItem.getItemId()
                    && isSameColor(chestItem, cartItem)
                    && chestItem.getAmount() < maxStack
                    && chestItem.getAmount() >= 0) {
                  int spaceAvailable = maxStack - chestItem.getAmount();

                  if (spaceAvailable >= cartItem.getAmount()) {
                    chestItem.setAmount(chestItem.getAmount() + cartItem.getAmount());
                    fromItems[cartSlot] = null;
                    setContents(inventories[invenIndex], chestItems);
                    changed = true;
                    throw new TransferredItemException();
                  } else {
                    cartItem.setAmount(cartItem.getAmount() - spaceAvailable);
                    chestItem.setAmount(maxStack);
                    changed = true;
                  }
                }
              }
            }

            if (changed) {
              setContents(inventories[invenIndex], chestItems);
            }
          }

          throw new TargetFullException();
        } catch (TransferredItemException e) {
        }

        if (itemAmount > 0 && currentAmount >= itemAmount) {
          if (itemCopy != null) {
            if (fromItems[cartSlot] != null) {
              itemCopy.setAmount(itemCopy.getAmount() + fromItems[cartSlot].getAmount());
            }

            fromItems[cartSlot] = itemCopy;
          }
          break;
        }
      }
    } catch (TargetFullException e) {
    }

    if (changed) {
      setContents(from, fromItems);
    }
  }
Example #17
0
  public static boolean onCommand(Player player, String[] split) {
    String ItemID;
    String ItemsFilep1 = "plugins/config/iExchange/GroupPrices/";
    String ItemsFilep2 = "sell.txt";

    if (split.length == 2) {
      player.sendMessage("§e[iExchange] §bUsage is /iex sell [Item] [Amount]");
      return true;
    } else {
      String Numberof = null;
      Inventory inventory = player.getInventory();
      if (split.length > 3) {
        Numberof = split[3];
      }
      int amount = 0;

      if (Numberof != null) {
        try {
          amount = Integer.parseInt(Numberof);
        } catch (NumberFormatException localNumberFormatException) {
          player.sendMessage("§e[iExchage] §cERROR 409: CONFLICT");
          player.sendMessage("§c(You didn't enter a proper number)");
          return true;
        }
      } else {
        amount = 1;
      }
      if (amount <= 0) {
        player.sendMessage("§e[iExchage] §cERROR 409: CONFLICT");
        player.sendMessage("§c(You entered a number less than 1)");
        return true;
      }
      ItemID = split[2].toUpperCase();
      ArrayList<String> ITEMPRICES = new ArrayList<String>();
      String[] group = player.getGroups();
      try {
        BufferedReader in =
            new BufferedReader(new FileReader(ItemsFilep1 + group[0] + ItemsFilep2));
        String str;
        while ((str = in.readLine()) != null) {
          String Upped = str.toUpperCase();
          String[] CheckName = Upped.split(":");
          if (CheckName[0].equals(ItemID)) {
            ITEMPRICES.add(str.toString());
          }
        }
        in.close();
      } catch (IOException e) {
        player.sendMessage("§e[iExchange] §cERROR 404: SellPriceList Not Found ");
        player.sendMessage("§c(the SellPriceList for your group does not exist)");
        player.sendMessage("§c(ask a ADMIN or the SERVER OWNER to correct the issue)");
        return true;
      }
      if (!(ITEMPRICES.isEmpty())) {
        String ItemIDS = ITEMPRICES.toString();
        String[] Item = ItemIDS.split(":");
        String PricePrice = Item[2].replace("]", "");
        int ID = 0;
        int price = 0;
        int damage = 0;
        try {
          ID = Integer.parseInt(Item[1]);
        } catch (NumberFormatException localNumberFormatException) {
          player.sendMessage("§e[iExchange] §cERROR 404: ITEM NOT FOUND!");
          player.sendMessage("§c(Props file error! Yell at your ADMIN or SERVER OWNER)");
          ITEMPRICES.clear();
          return true;
        }
        Item itemd = new Item();
        if ((ID == 6)
            || (ID == 17)
            || (ID == 18)
            || (ID == 35)
            || (ID == 44)
            || (ID == 98)
            || (ID == 263)
            || (ID == 351)
            || (ID == 358)) {
          damage = Integer.parseInt(Item[2]);
          if (Item[3].contains(",")) {
            String[] unfuck = Item[3].split(",");
            PricePrice = unfuck[0];
            itemd = new Item(ID, amount, -1, damage);
          } else {
            PricePrice = Item[3].replace("]", "");
            itemd = new Item(ID, amount, -1, damage);
          }
        } else {
          if (Item[2].contains(",")) {
            String[] unfuck = Item[2].split(",");
            PricePrice = unfuck[0];
          } else {
            PricePrice = Item[2].replace("]", "");
          }
          itemd = new Item(ID, amount);
        }
        try {
          price = Integer.parseInt(PricePrice);
        } catch (NumberFormatException localNumberFormatException) {
          player.sendMessage("§e[iExchange] §cERROR 404: PRICE NOT FOUND!");
          player.sendMessage("§c(Props file error! Yell at your ADMIN or SERVER OWNER)");
          ITEMPRICES.clear();
          return true;
        }
        String ItemItem = Item[0].replace("[", "");
        String ItemGave = ItemItem.toUpperCase();
        if (inventory.hasItem(itemd.getItemId())) {
          if ((ID == 6)
              || (ID == 17)
              || (ID == 18)
              || (ID == 35)
              || (ID == 44)
              || (ID == 98)
              || (ID == 263)
              || (ID == 351)
              || (ID == 358)) {
            int i = -1;
            int scan = -1;
            int invamount = 0;
            while (scan < 37) {
              scan++;
              if (inventory.getItemFromSlot(scan) != null) {
                Item itemcheck = inventory.getItemFromSlot(scan);
                int id1 = itemd.getItemId();
                int id2 = itemcheck.getItemId();
                int d1 = itemd.getDamage();
                int d2 = itemcheck.getDamage();
                int icA = itemcheck.getAmount();
                if ((id1 == id2) && (d1 == d2)) {
                  invamount += icA;
                }
              }
            }
            if (invamount < amount) {
              player.sendMessage("§e[iExchange] §cERROR 404: AMOUNT NOT FOUND!");
              player.sendMessage("§cYou don't have that much!");
              ITEMPRICES.clear();
              return true;
            }
            while (i <= 40) {
              i++;
              if (inventory.getItemFromSlot(i) != null) {
                Item item2 = inventory.getItemFromSlot(i);
                int id1 = itemd.getItemId();
                int id2 = item2.getItemId();
                int d1 = itemd.getDamage();
                int d2 = item2.getDamage();
                if ((id1 == id2) && (d1 == d2)) {
                  if (amount > 0) {
                    int oldamount = item2.getAmount();
                    int newamount = (oldamount - amount);
                    if (newamount <= 0) {
                      inventory.removeItem(i);
                      inventory.update();
                      amount -= oldamount;
                    } else {
                      inventory.removeItem(i);
                      inventory.setSlot(itemd.getItemId(), newamount, d1, i);
                      inventory.update();
                      amount -= oldamount;
                    }
                  } else {
                    break;
                  }
                }
              }
            }
            if (Numberof != null) {
              amount = Integer.parseInt(Numberof);
            } else {
              amount = 1;
            }
            etc.getLoader()
                .callCustomHook(
                    "iBalance", new Object[] {"deposit", player.getName(), (price * amount)});
            player.sendMessage(
                "§e[iExchange] §2" + amount + " " + ItemGave + " §bsold for §2$" + price * amount);
            ITEMPRICES.clear();
            return true;
          } else if (ID != 0) {
            int scan = -1;
            int invamount = 0;
            while (scan < 37) {
              scan++;
              if (inventory.getItemFromSlot(scan) != null) {
                Item itemcheck = inventory.getItemFromSlot(scan);
                int id1 = itemd.getItemId();
                int id2 = itemcheck.getItemId();
                int icA = itemcheck.getAmount();
                if (id1 == id2) {
                  invamount += icA;
                }
              }
            }
            if (invamount < amount) {
              player.sendMessage("§e[iExchange] §cERROR 404: AMOUNT NOT FOUND!");
              player.sendMessage("§cYou don't have that much!");
              ITEMPRICES.clear();
              return true;
            }
            int i = -1;
            while (i <= 40) {
              i++;
              if (inventory.getItemFromSlot(i) != null) {
                Item item2 = inventory.getItemFromSlot(i);
                int id1 = itemd.getItemId();
                int id2 = item2.getItemId();
                if ((id1 == id2)) {
                  if (amount > 0) {
                    int oldamount = item2.getAmount();
                    int newamount = (oldamount - amount);
                    if (newamount <= 0) {
                      inventory.removeItem(i);
                      inventory.update();
                      amount -= oldamount;
                    } else {
                      inventory.removeItem(i);
                      inventory.setSlot(itemd.getItemId(), newamount, i);
                      inventory.update();
                      amount -= oldamount;
                    }
                  } else {
                    break;
                  }
                }
              }
            }
            if (Numberof != null) {
              amount = Integer.parseInt(Numberof);
            } else {
              amount = 1;
            }
            etc.getLoader()
                .callCustomHook(
                    "iBalance", new Object[] {"deposit", player.getName(), (price * amount)});
            player.sendMessage(
                "§e[iExchange] §2" + amount + " " + ItemGave + " §bsold for §2$" + price * amount);
            ITEMPRICES.clear();
            return true;
          }
        } else {
          player.sendMessage("§e[iExchange] §cERROR 404: ITEM NOT FOUND!");
          player.sendMessage("§cYou don't have that item!");
          ITEMPRICES.clear();
          return true;
        }
      } else {
        player.sendMessage("§e[iExchange] §cError 400: ITEM NOT ON LIST!");
        player.sendMessage("§c(check your spelling or ask an ADMIN if item is on the list)");
        ITEMPRICES.clear();
        return true;
      }
    }
    return false;
  }