9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-29 11:39:14 +00:00

Ensure #setContents always sets correct size

This commit is contained in:
William
2023-10-11 19:02:46 +01:00
parent 51116cbdfb
commit 4d23377a18

View File

@@ -100,6 +100,10 @@ public abstract class BukkitData implements Data {
}
public void setContents(@NotNull ItemStack[] contents) {
// Ensure the array is the correct length for the inventory
if (contents.length != this.contents.length) {
contents = Arrays.copyOf(contents, this.contents.length);
}
System.arraycopy(contents, 0, this.contents, 0, this.contents.length);
}