Loosen restrictions on inventory sizing

Allows creating (but not opening) inventories created eg via Bukkit.createInventory(..., InventoryType.PLAYER);

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-04-27 12:50:43 +10:00
parent 520c838a5c
commit 65ed9737c3
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);
}