mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-06 07:02:18 -07:00
Implement inventory creation by type and title. Fixes BUKKIT-4045
With the current API it is possible to create an inventory with a specific type, but it is not possible to give such an inventory a title other than the default. The commit changes that by adding a method to optionally supply the title for the given inventory type and holder, creating the functionality to display any supported inventory type with a 32 character length String. If the inventory title supplied is larger than 32 characters then an IllegalArgumentException is thrown stating so.
This commit is contained in:
@@ -1506,6 +1506,10 @@ public final class CraftServer implements Server {
|
||||
return new CraftInventoryCustom(owner, type);
|
||||
}
|
||||
|
||||
public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) {
|
||||
return new CraftInventoryCustom(owner, type, title);
|
||||
}
|
||||
|
||||
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!");
|
||||
return new CraftInventoryCustom(owner, size);
|
||||
|
Reference in New Issue
Block a user