Kacper Drelich

make me a GUI for the /guikokoscode command there are 2 items: 1 is a pickaxe that mines 3x3, is unbreakable, has a custom name and lore, and efficiency 7 - 2 - an axe that chops down the whole tree at once, is unbreakable, has efficiency 7, has a custom name and lore

Kodari AI
KodariSep 17 at 5:56 pm 1
ToolMasterGUI
Creates a GUI-based plugin for the /guikokoscode command featuring two special tools. The first is an unbreakable 3x3 mining pickaxe with efficiency 7, custom name and lore. The second is an unbreakable whole-tree-chopping axe with efficiency 7, custom name and lore. Players open a 27-slot chest GUI displaying both tools as clickable buttons that grant the items to their inventory. Uses the lazy-initialization inventory framework with centralized GUIManager event handling for seamless item distribution.
  1. Create the Gradle project and plugin metadata for /guikokoscode.

  2. Add the GUI and custom item factory for the 3×3 pickaxe and tree-felling axe.

  3. Add event handling for GUI clicks, custom tool behavior, and inventory protection.

Created the KokosCodeTools plugin with:

  • /guikokoscode command opening a GUI

  • Custom Efficiency VII, unbreakable 3×3 mining pickaxe

  • Custom Efficiency VII, unbreakable tree-felling axe

  • Persistent item identification

  • Inventory click and drag protection

  • 3×3 mining based on the player’s facing direction

  • Connected tree-log chopping with a 4096-block safety limit

  • Gradle and plugin.yml configuration

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
6 322
src/main/java/com/kokoscode/KokosCodePlugin.java
package com.kokoscode;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class KokosCodePlugin extends JavaPlugin implements CommandExecutor {
    private NamespacedKey toolKey;
    private String menuTitle;

    @Override
    public void onEnable() {
        this.toolKey = new NamespacedKey(this, "kokoscode-tool");
        this.menuTitle = color("&8KokosCode Tools");

        PluginCommand command = Objects.requireNonNull(getCommand("guikokoscode"), "guikokoscode is missing from plugin.yml");
        command.setExecutor(this);

        Listener listener = new ToolListener(this);
        Bukkit.getPluginManager().registerEvents(listener, this);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("Only players can open this menu.");
            return true;
        }

        player.openInventory(createMenu());
        return true;
    }

    private Inventory createMenu() {
        Inventory inventory = Bukkit.createInventory(null, 27, menuTitle);
        inventory.setItem(11, ToolItems.createMiningPickaxe(toolKey));
        inventory.setItem(15, ToolItems.createTreeAxe(toolKey));
        return inventory;
    }

    public NamespacedKey getToolKey() {
        return toolKey;
    }

    public String getMenuTitle() {
        return menuTitle;
    }

    public static String color(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }
}