mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-23 18:45:31 +01:00
Update to 1.10, attempt fix for item overflow
This commit is contained in:
parent
bf2d3f6c78
commit
a9f2f228d6
2
pom.xml
2
pom.xml
@ -71,7 +71,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
<version>1.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.Acrobot.Breeze.Utils;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
*/
|
||||
@ -49,7 +49,7 @@ public class InventoryUtil {
|
||||
* @return Is the inventory empty?
|
||||
*/
|
||||
public static boolean isEmpty(Inventory inventory) {
|
||||
for (ItemStack stack : inventory.getContents()) {
|
||||
for (ItemStack stack : inventory.getStorageContents()) {
|
||||
if (!MaterialUtil.isEmpty(stack)) {
|
||||
return false;
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class InventoryUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (ItemStack iStack : inventory.getContents()) {
|
||||
for (ItemStack iStack : inventory.getStorageContents()) {
|
||||
if (left <= 0) {
|
||||
return true;
|
||||
}
|
||||
@ -125,7 +125,7 @@ public class InventoryUtil {
|
||||
|
||||
int amountLeft = item.getAmount();
|
||||
|
||||
for (int currentSlot = 0; currentSlot < inventory.getSize() && amountLeft > 0; currentSlot++) {
|
||||
for (int currentSlot = 0; currentSlot < effectiveSize(inventory) && amountLeft > 0; currentSlot++) {
|
||||
ItemStack currentItem = inventory.getItem(currentSlot);
|
||||
ItemStack duplicate = item.clone();
|
||||
|
||||
@ -152,6 +152,12 @@ public class InventoryUtil {
|
||||
return amountLeft;
|
||||
}
|
||||
|
||||
// Don't use the armor slots or extra slots
|
||||
private static int effectiveSize(Inventory inventory)
|
||||
{
|
||||
return inventory.getStorageContents().length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item to the inventor
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user