Loosen restrictions on inventory sizing

Allows creating (but not opening) inventories created eg via Bukkit.createInventory(..., InventoryType.PLAYER);
This commit is contained in:
md_5
2019-04-27 12:50:43 +10:00
parent 6606cd88d2
commit 6bb1f087e7
3 changed files with 3 additions and 4 deletions

View File

@@ -1503,13 +1503,13 @@ public final class CraftServer implements Server {
@Override
public Inventory createInventory(InventoryHolder owner, int size) throws IllegalArgumentException {
Validate.isTrue(size % 9 == 0, "Chests must have a size that is a multiple of 9!");
Validate.isTrue(9 <= size && size <= 54 && size % 9 == 0, "Size for custom inventory must be a multiple of 9 between 9 and 54 slots");
return CraftInventoryCreator.INSTANCE.createInventory(owner, size);
}
@Override
public Inventory createInventory(InventoryHolder owner, int size, String title) throws IllegalArgumentException {
Validate.isTrue(size % 9 == 0, "Chests must have a size that is a multiple of 9!");
Validate.isTrue(9 <= size && size <= 54 && size % 9 == 0, "Size for custom inventory must be a multiple of 9 between 9 and 54 slots");
return CraftInventoryCreator.INSTANCE.createInventory(owner, size, title);
}