From aa53e82e226b8215abca1c759bb9533898ec601c Mon Sep 17 00:00:00 2001 From: bensku Date: Wed, 16 Mar 2016 20:47:52 +0200 Subject: [PATCH] Fix error which would add items given to player to armor slots --- src/main/java/ch/njol/skript/aliases/ItemType.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/ch/njol/skript/aliases/ItemType.java b/src/main/java/ch/njol/skript/aliases/ItemType.java index e567b5c0b3c..a85d7c60da2 100644 --- a/src/main/java/ch/njol/skript/aliases/ItemType.java +++ b/src/main/java/ch/njol/skript/aliases/ItemType.java @@ -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) { @@ -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);