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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user