CraftKit - Custom GUI

Jun 29, 2020
CraftKit - Custom GUI
  • Code (Text):
        CustomGUI cg = extension.createCustomGUI(null, 45, ChatUtil.formatColorCodes("&aRainbow &fInventory")); // make an empty inventory with 45 slots
        InventoryUtil.fillAll(cg, new ItemBuilder(Material.APPLE)
                .name("&a")
                .build()); // fill the inventory with apples
        cg.addContentCallback(SlotCallback.PREVENT_MODIFY); // make inventory uneditable
        cg.addContentCallback(new SlotCallback() {
            @Override
            public void click(InventoryClickEvent event, Player player, BaseGUI gui) {
                InventoryUtil.fillAll(cg, new ItemBuilder(RandomUtil.pickRandom(MaterialUtil.getStainedGlassPaneTypes())).name("&a").build());
                player.damage(0.0001);
            }
        });
        player.openInventory(cg);
  • Loading...
  • Loading...