Skip to content

Commit

Permalink
Fix error which would add items given to player to armor slots
Browse files Browse the repository at this point in the history
  • Loading branch information
bensku committed Mar 16, 2016
1 parent f7bb0ab commit aa53e82
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/ch/njol/skript/aliases/ItemType.java
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ public boolean addTo(final Inventory invi) {
ItemStack[] buf = invi.getContents();
if (buf == null)
return false;
Skript.info("buf is " + Arrays.toString(buf));

if (invSizeWorkaround) { // MC < 1.9
if (buf.length > 36) {
Expand All @@ -888,6 +889,14 @@ public boolean addTo(final Inventory invi) {
buf[i] = tBuf[i];
}
}
} else {
if (invi instanceof PlayerInventory) {
ItemStack[] tBuf = buf.clone();
buf = new ItemStack[36];
for(int i = 0; i < 36; ++i) {
buf[i] = tBuf[i];
}
}
}

final boolean b = addTo(buf);
Expand Down

0 comments on commit aa53e82

Please sign in to comment.