mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 14:04:49 +01:00
Loosen restrictions on inventory sizing
Allows creating (but not opening) inventories created eg via Bukkit.createInventory(..., InventoryType.PLAYER);
This commit is contained in:
parent
6606cd88d2
commit
6bb1f087e7
3 changed files with 3 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||
customSize = Containers.GENERIC_9X6;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported custom size " + inventory.getSize());
|
||||
throw new IllegalArgumentException("Unsupported custom inventory size " + inventory.getSize());
|
||||
}
|
||||
openCustomInventory(inventory, player, customSize);
|
||||
break;
|
||||
|
|
|
@ -55,7 +55,6 @@ public class CraftInventoryCustom extends CraftInventory {
|
|||
|
||||
public MinecraftInventory(InventoryHolder owner, int size, String title) {
|
||||
Validate.notNull(title, "Title cannot be null");
|
||||
Validate.isTrue(9 <= size && size <= 54 && size % 9 == 0, "Size for custom inventory must be a multiple of 9 between 9 and 54 slots");
|
||||
this.items = NonNullList.a(size, ItemStack.a);
|
||||
this.title = title;
|
||||
this.viewers = new ArrayList<HumanEntity>();
|
||||
|
|
Loading…
Reference in a new issue