gtm123

make this

📎 1 file 5,361 chars
📄
pasted-code-1783030984441.txt
txt 51 lines
▶
# DonutTools - Comprehensive Plugin Documentation
DonutTools is an advanced, highly customizable custom tools plugin designed for modern Minecraft servers (Paper 1.21.1+). It introduces a variety of unique tools with specialized mechanics, custom durability systems, integrated INVENTORY GUI menus, and full protections integration.
## Core Systems & Mechanics
### 1. Custom Durability System
Every tool in the plugin can be configured with one of three durability modes:
* **USES:** The tool expires after a specific number of successful operations (e.g., breaking 100 blocks, filling 27 buckets). 
* **TIME:** The tool expires after a specific real-time duration (e.g., 2 Days). Time continues to tick even when the player is offline.
* **INFINITE:** The tool never breaks and lasts forever.
When a tool breaks or expires, the plugin plays a shattering sound, removes the item from the player's inventory, and sends an action bar/chat notification.
### 2. Universal Protections
All block-breaking and interacting tools are fully integrated with:
* **WorldGuard:** Tools respect regions and will not work if the player does not have build permissions.
* **PlotSquared:** Tools respect plot boundaries and ownership.
### 3. Dynamic Lore & Hex Colors
* Tool Lore is fully dynamic and updates in real-time. For time-based tools, it formats the remaining time (e.g., `1d 12h 30m`). For use-based tools, it displays the exact remaining uses.
* The plugin fully supports modern Hex Color codes (e.g., `&#FF5555`) across all item names, lores, and chat messages.
### 4. Custom Particles & Sounds
Every tool can trigger specific sound effects (configurable volume/pitch) and spawn specialized particle effects when used, offering a highly satisfying feedback loop for players.
---
## The Tools & Features
### 1. Drill (Netherite Pickaxe)
* **Mechanic:** A powerful mining tool that breaks multiple blocks at once. By default, it mines a `3x3` flat area on the face of the block hit.
* **Advanced Radius:** The tool intelligently accounts for Player Pitch and Yaw. If the player looks straight down and mines, it clears a 3x3 square on the floor. The mining radius is fully customizable in the config (X, Y, Z), allowing server owners to create variants like a `3x3x3` Rubik's cube drill that clears a perfect cube centered around the broken block.
* **Default Enchantments:** Efficiency 5, Unbreaking 3, Fortune 3, Mending 1.
### 2. TreeChopper (Netherite Axe)
* **Mechanic:** Instantly chops down entire trees in a single swing. It uses a recursive algorithm to detect connected logs and leaves, dropping all items at once.
* **Default Enchantments:** Efficiency 5, Unbreaking 3, Sharpness 3, Sweeping Edge 3, Mending 1.
### 3. Shovel (Netherite Shovel)
* **Mechanic:** Digs a `3x3` area of dirt, sand, gravel, and other shovel-appropriate blocks instantly.
* **Default Enchantments:** Efficiency 5, Unbreaking 3, Fortune 3, Mending 1.
### 4. Hoe (Netherite Hoe)
* **Mechanic:** Tills farmland or harvests fully grown crops in a `3x3` radius with a single click. 
* **Default Enchantments:** Efficiency 5, Unbreaking 3, Fortune 3, Mending 1.
### 5. Amethyst Multi-Tool
* **Mechanic:** The ultimate all-in-one tool. It uses a background task and interaction events to detect the block the player is looking at (or hitting) and *automatically morphs* into the perfect tool for the job (Pickaxe for stone, Axe for wood, Shovel for dirt, Hoe for crops).
* **Enchantment Retention:** When the tool morphs, it seamlessly transfers all custom names, lore, and enchantments to the new material. (It translates legacy names like `EFFICIENCY` to modern keys like `DIG_SPEED` under the hood).
* **Default Enchantments:** Efficiency 5, Unbreaking 3, Fortune 3, Mending 1.
### 6. Sell Axe (Golden Axe)
* **Mechanic:** A utility tool integrated directly with **Vault**. When a player left-clicks or right-clicks a container (Chest, Trapped Chest, Barrel), the Sell Axe scans the inventory, calculates the total worth of the items based on a custom `prices.yml`, sells the items, clears them from the chest, and deposits the money directly into the player's balance.
* **Default Enchantments:** None (Relies on custom particles and level-up sounds for satisfaction).
### 7. Water Bucket
* **Mechanic:** A specialized bucket capable of storing multiple sources of water. By default, it holds up to `27` uses.
* **Emptying & Refilling:** When the player places water 27 times, the item turns into an `Empty Water Bucket`. The player can then refill it by right-clicking water sources in the world. Each scooped water block restores 1 use to the bucket, until it hits 27 and morphs back into a full Water Bucket.
* **Default Enchantments:** Unbreaking 3, Mending 1.
---
## Commands & INVENTORY GUI
* **`/tools`** - Opens the interactive **Tools INVENTORY GUI**, allowing players with permissions to easily claim tools.
* **`/tools reload`** - Reloads all configuration files seamlessly.
* **`/tools give   [mode] [amount]`** - Admin command to spawn tools with specific durability constraints. (e.g., `/tools give Steve drill uses 500`).
* **INVENTORY GUI Configuration:** Completely customizable via `main_menu.yml`. Server owners can define slots, custom filler glass, titles, and sound effects when items are claimed.
Kodari AI
KodariJul 2 at 10:28 pm 2
DonutTools
An advanced custom tools plugin for Paper 1.21.1+ featuring a unique tool system with Drill (area mining), TreeChopper (instant tree felling), Shovel (3x3 digging), Hoe (tilling/harvesting), Amethyst Multi-Tool (auto-morphing), Sell Axe (Vault-integrated chest selling), and Water Bucket (multi-use). Includes a custom durability system (USES/TIME/INFINITE), dynamic real-time lore, MiniMessage hex colors, custom particles/sounds, WorldGuard/PlotSquared protection integration, and a fully customizable GUI menu for claiming tools.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
29 1,997
src/main/java/com/donuttools/DonutTools.java
package com.donuttools;

import com.donuttools.commands.ToolsCommand;
import com.donuttools.config.ConfigManager;
import com.donuttools.durability.DurabilityManager;
import com.donuttools.inventory.gui.GUIListener;
import com.donuttools.inventory.gui.GUIManager;
import com.donuttools.listeners.ToolListener;
import com.donuttools.tools.ToolManager;
import com.donuttools.tools.mechanics.*;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

public class DonutTools extends JavaPlugin {
    private static DonutTools instance;

    private ConfigManager configManager;
    private ToolManager toolManager;
    private DurabilityManager durabilityManager;
    private GUIManager guiManager;
    private Economy economy;

    private DrillMechanic drillMechanic;
    private TreeChopperMechanic treeChopperMechanic;
    private ShovelMechanic shovelMechanic;
    private HoeMechanic hoeMechanic;
    private AmethystMechanic amethystMechanic;
    private SellAxeMechanic sellAxeMechanic;
    private WaterBucketMechanic waterBucketMechanic;

    public static DonutTools getInstance() {
        return instance;
    }

    @Override
    public void onEnable() {
        instance = this;

        saveDefaultConfig();
        this.configManager = new ConfigManager(this);
        this.toolManager = new ToolManager(this);
        this.durabilityManager = new DurabilityManager(this, toolManager);
        this.guiManager = new GUIManager();

        // Setup Vault economy
        if (Bukkit.getPluginManager().getPlugin("Vault") != null) {
            RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
            if (rsp != null) {
                economy = rsp.getProvider();
                getLogger().info("Vault economy found!");
            }
        }

        // Initialize mechanics
        this.drillMechanic = new DrillMechanic(this);
        this.treeChopperMechanic = new TreeChopperMechanic(this);
        this.shovelMechanic = new ShovelMechanic(this);
        this.hoeMechanic = new HoeMechanic(this);
        this.amethystMechanic = new AmethystMechanic(this);
        this.sellAxeMechanic = new SellAxeMechanic(this, economy);
        this.waterBucketMechanic = new WaterBucketMechanic(this);

        // Register listeners
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new ToolListener(this), this);

        // Register command
        getCommand("tools").setExecutor(new ToolsCommand(this));

        // Start durability timer
        durabilityManager.startTimer();

        getLogger().info("DonutTools v" + getDescription().getVersion() + " enabled!");
    }

    @Override
    public void onDisable() {
        if (durabilityManager != null) {
            durabilityManager.stopTimer();
        }
        getLogger().info("DonutTools disabled!");
    }

    public ConfigManager getConfigManager() { return configManager; }
    public ToolManager getToolManager() { return toolManager; }
    public DurabilityManager getDurabilityManager() { return durabilityManager; }
    public GUIManager getGuiManager() { return guiManager; }
    public Economy getEconomy() { return economy; }
    public DrillMechanic getDrillMechanic() { return drillMechanic; }
    public TreeChopperMechanic getTreeChopperMechanic() { return treeChopperMechanic; }
    public ShovelMechanic getShovelMechanic() { return shovelMechanic; }
    public HoeMechanic getHoeMechanic() { return hoeMechanic; }
    public AmethystMechanic getAmethystMechanic() { return amethystMechanic; }
    public SellAxeMechanic getSellAxeMechanic() { return sellAxeMechanic; }
    public WaterBucketMechanic getWaterBucketMechanic() { return waterBucketMechanic; }
}