Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
Loosen restrictions on inventory sizing
Allows creating (but not opening) inventories created eg via Bukkit.createInventory(..., InventoryType.PLAYER);
Dieser Commit ist enthalten in:
Ursprung
6606cd88d2
Commit
6bb1f087e7
@ -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>();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren