Skip to content
WolfyScript edited this page Apr 15, 2021 · 8 revisions

CustomCache

You'll see that many components part of the InventoryAPI are using the CustomCache object.
It allows to cache data for players, which might be important for the functionality of your GUI.
For each player, the API will create a new CustomCache instance.

By default, the CustomCache class doesn't contain lots of flexibility, so for more advanced usage, you should create your own class.

public class YourCache extends CustomCache {
    
    public CCCache() {
        super();
    }   

}

And then set your class to the InventoryAPI. (Best in your plugins constructor!)

api.setInventoryAPI(new InventoryAPI<>(plugin, api, YourCache.class));

Structure

The GUI API follows a structure to make it consistent as possible and easily manageable.

It has the following main parts:

  • InventoryAPI - contains all of the data and is the parent of everything.
  • GuiCluster - a cluster of multiple GuiWindows.
  • GuiWindow - a window that contains all the logic and buttons to render the items into the Inventory.
  • Buttons - used to render interactive ItemStacks into the GUI.

| Home

| GUIs

| NBT Tools

Clone this wiki locally