Inventory GuiAPI 1.0

Create inventories with ease

  1. Ragnok123
    Tested Minecraft Versions:
    • 1.8
    Source Code:
    https://github.com/Ragnok123/GuiAPI
    Contributors:
    Ragnok123
    To create new inventory menu, you should do this:

    Code (Text):
    InventoryMenu menu = new InventoryMenu();
    Every menu has a category. It is made to avoid bilion times changing menu content. Hovewer, every menu has optimal main category. To create new category, you can simply do this:

    Code (Text):
    InventoryCategory category = new InventoryCategory();
    You can add items to your category:

    Code (Text):
    java
    category.addElement(0, new ItemData(Material.STONE));
    category.addElement(1, new ItemData(Material.DIRT), new ItemClick(){
        public void onClick(Player player, ItemStack item){
            player.sendMessage("Clicked item");
        }
    });
     
    If there are too much items, you can add them via string characters.
    Code (Text):
    String[] mainItems = new String[] {
                        "xxxxxxxxx",
                        "xvvvvvvvx",
                        "xvvvgvvvx",
                        "xvvvgvvvx",
                        "xvvvvvvvx",
                        "xxxxxxxxx"
                };
    HashMap<Character, ItemData> lmao = new HashMap<Character, ItemData>();

    lmao.put('x', new ItemData(Material.STAINED_GLASS_PANE));
    lmao.put('v', new ItemData(Material.GOLD_INGOT));
    lmao.put('g', new ItemData(Material.IRON_SWORD));
                 
    HashMap<Character, ItemClick> l = new HashMap<Character, ItemClick>();
    l.put('g', new ItemClick() {
        public void onClick(Player player, ItemStack item) {
            player.sendMessage("Clicked sword");
        }
    });
    category.setStringElements(mainItems, lmao, l);
    Dont forget to set main category.
    Code (Text):
    menu.setMainCategory(category);
    Or just add as another category:
    Code (Text):
    menu.addCategory(String id, category);
    Making custom text is also easy:
    Code (Text):
    menu.setName("§l§eMenu");
    If you want only read menu without transactions, just make:
    Code (Text):
    menu.setOnlyRead(true);
    To send menu, just use
    Code (Text):
    menu.show(player);
    Or force close with

    Code (Text):
    menu.forceDestroy(player);
    And finally, you can register new menu:
    Code (Text):
    InventoryMenuHandler.registerNewMenu(String id, menu);

    Images

    1. Screenshot_156.png