-
Notifications
You must be signed in to change notification settings - Fork 2
GuiBuilder
Julian Weinelt edited this page Jun 13, 2025
·
2 revisions
With the GuiBuilder, you can create GUIs of any type really fast.
To start using the GuiBuilder, create a new object by passing the title and rows (or InventoryType)
// Create a simple GUI with 36 Slots.
GuiBuilder builder = new GuiBuilder("Title", 4);
// Use de.codeblocksmc.codelib.api.wrapping.adventure.GuiBuilder for use with adventure API
GuiBuilder builder = new GuiBuilder(Component.text("Title"), 4);
// Creating an inventory with a different type than chest
GuiBuilder builder = new GuiBuilder(InventoryType.ANVIL, "Title");// Setting a slot with ItemStack
builder.slot(0, stack);
// You can also use an ItemBuilder directly:
builder.slot(1, new ItemBuilder(Material.BARRIER).displayName("Just an item"));
// To use multiple slots
builder.slots(Material.GRAY_STAINED_GLASS_PANE, 3, 4, 5, 6, 7, 8); // Will create an item with an empty displayname
builder.fillerPlaceholder(Material.GRAY_STAINED_GLASS_PANE); // Same as slots(), but without slots. Will fill the whole GUI.
builder.openForPlayer(player); // Will open the GUI for the specified player.
Inventory inventory = builder.build(); // Creates the Inventory object for Bukkit.