Package io.github.viimeinen1.ainventory
Class aInventory.Builder<T extends aInventory.Builder<T,K>,K extends aInventory>
java.lang.Object
io.github.viimeinen1.ainventory.aInventory.Builder<T,K>
- Direct Known Subclasses:
aGUIInventory.Builder,aInventory.DefaultBuilder
- Enclosing class:
aInventory
public abstract static class aInventory.Builder<T extends aInventory.Builder<T,K>,K extends aInventory>
extends Object
Custom inventory builder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Kbuild()Inventory close function.defaultAction(@NotNull aInventory.itemClickFunction fn) Function that will be ran every time inventory is clicked.abstract TgetThis()Set initialization function for the inventory.Inventory open function.Set owner of the inventory.require(aInventory.requirementFunction requirementFunction) Function that is ran every time inventory is opened, or slot is clicked.Set size of the inventory.<R> Ttitle(R title) Set the title of the inventory.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
getThis
-
build
-
initialization
Set initialization function for the inventory. The function can be called later withaInventory.initialize().- Parameters:
fn-invalid reference
inventoryInitializationFunction- Returns:
- builder
-
defaultAction
Function that will be ran every time inventory is clicked.- Parameters:
fn-aInventory.itemClickFunction- Returns:
- builder
-
openFunction
Inventory open function.- Parameters:
fn-aInventory.inventoryOpenFunction- Returns:
- builder
-
closeFunction
Inventory close function.- Parameters:
fn-aInventory.inventoryCloseFunction- Returns:
- builder
-
size
Set size of the inventory.- Parameters:
size-aInventory.INVENTORY_SIZE- Returns:
- builder
-
title
Set the title of the inventory. Accepts bothStringandComponent. Giving object with other types will fail silently. IfString, the string will be deserialized as minimessage.- Type Parameters:
R-StringorComponent- Parameters:
title- title that will be set as the inventory title.- Returns:
- builder
-
owner
Set owner of the inventory. Setting owner of the inventory will restrict it's usage to only it's owner.- Parameters:
owner-UUIDof the owner.- Returns:
- builder
-
require
Function that is ran every time inventory is opened, or slot is clicked. If function returns false, all futher execution is blocked.- Parameters:
requirementFunction-aInventory.requirementFunction
-