SPIGOT-8038: Skip adding/removing air from inventory via API
This commit is contained in:
parent
080253d4f4
commit
d688748af6
@ -284,6 +284,10 @@ public class CraftInventory implements Inventory {
|
|||||||
for (int i = 0; i < items.length; i++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
ItemStack item = items[i];
|
ItemStack item = items[i];
|
||||||
Preconditions.checkArgument(item != null, "ItemStack cannot be null");
|
Preconditions.checkArgument(item != null, "ItemStack cannot be null");
|
||||||
|
// SPIGOT-8038: Cannot add/remove air. Probably should be an exception, but ignored for compatibility
|
||||||
|
if (item.getType().isAir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
// Do we already have a stack of it?
|
// Do we already have a stack of it?
|
||||||
int firstPartial = firstPartial(item);
|
int firstPartial = firstPartial(item);
|
||||||
@ -348,6 +352,10 @@ public class CraftInventory implements Inventory {
|
|||||||
for (int i = 0; i < items.length; i++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
ItemStack item = items[i];
|
ItemStack item = items[i];
|
||||||
Preconditions.checkArgument(item != null, "ItemStack cannot be null");
|
Preconditions.checkArgument(item != null, "ItemStack cannot be null");
|
||||||
|
// SPIGOT-8038: Cannot add/remove air. Probably should be an exception, but ignored for compatibility
|
||||||
|
if (item.getType().isAir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int toDelete = item.getAmount();
|
int toDelete = item.getAmount();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user