diff --git a/Minepacks-API/src/at/pcgamingfreaks/Minepacks/Bukkit/API/Backpack.java b/Minepacks-API/src/at/pcgamingfreaks/Minepacks/Bukkit/API/Backpack.java index 765ac03..13ad475 100644 --- a/Minepacks-API/src/at/pcgamingfreaks/Minepacks/Bukkit/API/Backpack.java +++ b/Minepacks-API/src/at/pcgamingfreaks/Minepacks/Bukkit/API/Backpack.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -123,6 +123,7 @@ public interface Backpack extends InventoryHolder */ default @NotNull Map addItems(ItemStack... itemStacks) { + setChanged(); return getInventory().addItem(itemStacks); } } \ No newline at end of file diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java index d567c73..4171b02 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java @@ -28,8 +28,8 @@ import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; -import java.util.HashMap; import java.util.List; +import java.util.Map; public class ItemsCollector extends BukkitRunnable { @@ -69,7 +69,7 @@ public void run() if(!item.isDead() && item.getPickupDelay() <= 0) { if(itemFilter != null && itemFilter.isItemBlocked(item.getItemStack())) continue; - HashMap full = backpack.getInventory().addItem(item.getItemStack()); + Map full = backpack.addItems(item.getItemStack()); backpack.setChanged(); if(!full.isEmpty()) { diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemShortcut.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemShortcut.java index f2037d1..34e55cf 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemShortcut.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemShortcut.java @@ -44,7 +44,6 @@ import org.jetbrains.annotations.Nullable; import java.util.Iterator; -import java.util.Map; import java.util.UUID; public class ItemShortcut implements Listener @@ -178,8 +177,8 @@ public void onItemClick(InventoryClickEvent event) final ItemStack stack = event.getCursor(); if(plugin.getItemFilter() == null || !plugin.getItemFilter().isItemBlocked(stack)) { - Map full = backpack.getInventory().addItem(stack); - stack.setAmount((full.isEmpty()) ? 0 : full.get(0).getAmount()); + ItemStack full = backpack.addItem(stack); + stack.setAmount((full == null) ? 0 : full.getAmount()); event.setCancelled(true); } else