diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java index 1bc1e64a4..083f926ee 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java @@ -6,6 +6,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -43,11 +44,7 @@ public final class InventoryWorkaround { private static Inventory makeTruncatedPlayerInventory(PlayerInventory playerInventory) { Inventory fakeInventory = Bukkit.getServer().createInventory(null, USABLE_PLAYER_INV_SIZE); - - ItemStack[] truncatedContents = new ItemStack[fakeInventory.getSize()]; - System.arraycopy(playerInventory.getContents(), 0, truncatedContents, 0, truncatedContents.length); - fakeInventory.setContents(truncatedContents); - + fakeInventory.setContents(Arrays.copyOf(playerInventory.getContents(), fakeInventory.getSize())); return fakeInventory; }