Complex Inventories icon

Complex Inventories -----

Extremely power API to create (animated) GUI's and break outside Spigot's limits



[​IMG]
This API allows you to make super light-weight GUI's with extreme power! You can make static GUI's, animated GUI's (for if you're showing a live playercount or just wanna be fancy)! You can use many things, you can also integrate this API in your plugin and make all of your GUI's run on this power engine! It's called "Complex" for a reason...

Step-by-step on how to initialize, create and use the API!

This is how you initialize the libary:
Code (Java):

public final class Main extends JavaPlugin {

    @Override
    public void onEnable ( ) {
        ComplexInventories. Initialize ( this ) ;
    }
}
Let's take for instance that you create a GUI for in your hub, this is how what you need to add in your hub class:
Code (Java):
public class Hub {
    public Base complexInventory ;

    public Hub (JavaPlugin plugin ) {

        plugin. getCommand ( "open" ). setExecutor ( new TestCommand ( this ) ) ;

        complexInventory = new Base (plugin ) {
            @Override
            protected ComplexInventory <? extends Base > buildScreen (Player player ) {
                return new TestScreen <> (getPlugin ( ), this, "Title", player, 54 ) ;
            }
       
            @Override
            public void updateScreen ( ) {
                for (ComplexInventory <? extends Base > page : getPageMap ( ). values ( ) ) {
                    if (page instanceof TestScreen )
                        ( (TestScreen <? extends Base > ) page ). buildPage ( ) ;
                }
            }
        } ;
    }

    @EventHandler
    public void refreshScreen (RefreshEvent event ) {
        if (event. getType ( ) != RefreshType. ONE )
            return ;

        complexInventory. updateScreen ( ) ;
    }
}
Let's take for instance that you create a GUI for in your hub, this is how what you need to add in your hub class:
Code (Java):
public class Hub {
    public Base complexInventory ;

    public Hub (JavaPlugin plugin ) {

        plugin. getCommand ( "open" ). setExecutor ( new TestCommand ( this ) ) ;

        complexInventory = new Base (plugin ) {
            @Override
            protected ComplexInventory <? extends Base > buildScreen (Player player ) {
                return new TestScreen <> (getPlugin ( ), this, "Title", player, 54 ) ;
            }

            @Override
            public void updateScreen ( )
            { } //Only if u have an animated GUI
        } ;
    }
}
Code (Java):
public class TestScreen <BaseType extends Base > extends ComplexInventory <BaseType > {
    public TestScreen (JavaPlugin plugin, BaseType type, String name, Player player, int slots ) {
        super (plugin, type, name, player, slots ) ;
        buildPage ( ) ;
    }

    @Override
    protected void buildPage ( ) {
        clearPage ( ) ;
        addItem ( 4, new Item (Material. GRASS, "" + GREEN + BOLD + "Grass Item", 1, true ) ) ;
    }
}
I'm gonna be using a simple command to do that:
Code (Java):
public class TestCommand implements CommandExecutor {
    private final Hub hub ;

    public TestCommand (Hub hub ) {
        this. hub = hub ;
    }

    @Override
    public boolean onCommand (CommandSender sender, Command command, String label, String [ ] args ) {
        hub. complexInventory. openScreen ( (Player ) sender ) ;
        return true ;
    }
}
[​IMG]
Resource Information
Author:
----------
Total Downloads: 69
First Release: Jan 17, 2021
Last Update: Jan 17, 2021
Category: ---------------
All-Time Rating:
1 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings