Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void removeItems(final List<ItemStack> items, final Player player) {
- final Inventory inv = (Inventory)player.getInventory();
- final List<ItemStack> removes = new ArrayList<ItemStack>();
- for (final ItemStack item : items) {
- if (inv.containsAtLeast(item, item.getAmount())) {
- removes.add(item);
- }
- }
- if (removes.size() == items.size()) {
- for (final ItemStack item : items) {
- for (final ItemStack remove : removes) {
- if (item.getType().equals((Object)remove.getType()) && item.getData().equals((Object)remove.getData())) {
- inv.removeItem(new ItemStack[] { item });
- }
- }
- }
- }
- removes.clear();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement