mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
Allow inventory creation by InventoryType and title. Fixes BUKKIT-4045
Up until now it has not been possible to create a new Inventory using a custom title and permit any InventoryType available. 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. By: eueln <euelnd@gmail.com>
This commit is contained in:
parent
ec20888a8a
commit
abd8cbed5e
2 changed files with 21 additions and 0 deletions
|
@ -591,6 +591,13 @@ public final class Bukkit {
|
|||
return server.createInventory(owner, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#createInventory(InventoryHolder owner, InventoryType type, String title)
|
||||
*/
|
||||
public static Inventory createInventory(InventoryHolder owner, InventoryType type, String title) {
|
||||
return server.createInventory(owner, type, title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Server#createInventory(InventoryHolder owner, int size)
|
||||
*/
|
||||
|
|
|
@ -692,6 +692,20 @@ public interface Server extends PluginMessageRecipient {
|
|||
*/
|
||||
Inventory createInventory(InventoryHolder owner, InventoryType type);
|
||||
|
||||
/**
|
||||
* Creates an empty inventory with the specified type and title. If the type
|
||||
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
|
||||
* otherwise the new inventory has the normal size for its type.<br />
|
||||
* It should be noted that some inventory types do not support titles and
|
||||
* may not render with said titles on the Minecraft client.
|
||||
*
|
||||
* @param owner The holder of the inventory; can be null if there's no holder.
|
||||
* @param type The type of inventory to create.
|
||||
* @param title The title of the inventory, to be displayed when it is viewed.
|
||||
* @return The new inventory.
|
||||
*/
|
||||
Inventory createInventory(InventoryHolder owner, InventoryType type, String title);
|
||||
|
||||
/**
|
||||
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
|
||||
* specified size.
|
||||
|
|
Loading…
Reference in a new issue