sy671
๐Ÿ“Ž 1 file 2,481 chars
๐Ÿ“„
pasted-code-1776797253886.txt
txt 92 lines
โ–ถ
You are an expert Java developer specialized in Minecraft Paper plugins (Paper API 1.21.1+).

Create a fully functional Minecraft plugin called **"VyxelAHBots"**.

## Goal

The plugin should simulate an Auction House with BOT listings (not real players). These bots should NOT appear in the tab list or as entities. They only exist as fake sellers in the Auction House.

## Core Features

1. **Fake Auction Listings**

   * Automatically generate auction listings using fake bot names.
   * Bots should look realistic (e.g., random usernames).
   * Listings behave like real `/ah sell` entries.

2. **No Real Players**

   * Bots must NOT be real players, NPCs, or visible entities.
   * They should only exist in the auction system.

3. **Item Configuration System**

   * Create a folder structure inside the plugin directory:

     ```
     /plugins/VyxelAHBots/
       โ”œโ”€โ”€ config.yml
       โ”œโ”€โ”€ items/
           โ”œโ”€โ”€ dirt.yml
           โ”œโ”€โ”€ example.yml
     ```

4. **Item Config Files**

   * Each item file defines:

     * Material (e.g., DIRT)
     * Min price
     * Max price
     * Stack size
     * Chance to appear
   * Include at least one default example (`dirt.yml`) so users understand the format.

5. **Main Config (`config.yml`)**

   * Settings like:

     * Enable/disable plugin
     * Listing interval (in seconds)
     * Max active listings
     * Bot name format (random or preset list)
     * Price randomness behavior

6. **Auction Behavior**

   * Listings should be added at a configurable interval.
   * Prices should be randomized between min/max values.
   * Items rotate based on configured chances.

7. **Integration**

   * Assume compatibility with a typical `/ah` plugin system (like EconomyShopGUI or similar).
   * If no API is available, simulate internal listing logic.

8. **Code Quality**

   * Clean, modular Java code
   * Use proper OOP structure
   * Include comments explaining key parts
   * Separate classes for:

     * Main plugin
     * Bot generator
     * Item loader
     * Auction manager

9. **Extras**

   * Random bot name generator
   * Reload command `/vyxelahbots reload`
   * Console logs for debugging

## Output Requirements

* Full Java source code
* plugin.yml
* Example config.yml
* Example item config (dirt.yml)
* Clear explanation of how everything works

Make sure the plugin compiles and follows Paper API standards.
Kodari AI
KodariApr 21 at 6:51 pm 14,592 (v2)
VyxelAHBots
Simulates a realistic Auction House populated by fake bot listings (no real players or entities). Bots automatically post randomized item listings at configurable intervals, with prices randomized between min/max values and items selected by weighted chance. Features a browsable chest GUI, Vault economy integration for purchases, a YAML-based item config system in an items/ folder, bot name generation, and a /vyxelahbots reload command.

Planning class dependencies before writing:

  • VyxelAHBots โ†’ has GUIManager, ItemLoader, AuctionManager, BotNameGenerator

  • ItemLoader โ†’ produces List<BotItem> from YAML files in items/

  • AuctionManager โ†’ uses ItemLoader, BotNameGenerator, BotListing, schedules tasks

  • AuctionGUI โ†’ extends InventoryGUI, reads AuctionManager listings, uses Vault for purchase

  • AHBotCommand โ†’ reloads config/items, restarts scheduler

  • Vault needed as compileOnly in build.gradle

Now I have everything needed. Let me build the complete plugin:

  • VyxelAHBots main class with Vault economy hook, GUIManager, ItemLoader, BotNameGenerator, AuctionManager

  • BotItem + BotListing data classes with Lombok

  • ItemLoader reads YAML files from items/ folder

  • AuctionManager schedules repeated bot listings using Bukkit scheduler

  • AuctionGUI multi-page chest GUI using the GUI framework with buy support via Vault

  • AHBotCommand for /vyxelahbots reload

VyxelAHBots
Simulates a realistic Auction House populated by fake bot listings (no real players or entities). Bots automatically post randomized item listings at configurable intervals, with prices randomized between min/max values and items selected by weighted chance. Features a browsable chest GUI, Vault economy integration for purchases, a YAML-based item config system in an items/ folder, bot name generation, and a /vyxelahbots reload command.

The plugin is complete. Hereโ€™s a summary of what was built:

Structure:

  • VyxelAHBots โ€” main plugin, wires up all managers, hooks Vault, copies default item configs

  • BotItem / BotListing โ€” Lombok data classes for item templates and active listings

  • ItemLoader โ€” scans plugins/VyxelAHBots/items/*.yml, picks items by weighted chance

  • BotNameGenerator โ€” combines a name pool + format templates from config to produce realistic usernames

  • AuctionManager โ€” Bukkit repeating task that adds listings at the configured interval, enforces max listing cap, builds ItemStack via XMaterial

  • AuctionGUI โ€” paginated 54-slot chest GUI (45 item slots + prev/info/next row), shows bot seller name + price on lore, handles Vault withdrawal on click

  • AHBotCommand โ€” /vyxelahbots opens the GUI, reload reloads config/items/scheduler, list prints active listings to console/chat

Usage: Drop in items/ YAML files with material, min-price, max-price, stack-size, chance, display-name, and lore. Players open the AH with /vyxelahbots, click an item to buy it, and money is deducted via Vault.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
18 924
src/main/java/com/vyxel/ahbots/VyxelAHBots.java
package com.vyxel.ahbots;

import com.vyxel.ahbots.command.AHBotCommand;
import com.vyxel.ahbots.inventory.gui.GUIListener;
import com.vyxel.ahbots.inventory.gui.GUIManager;
import com.vyxel.ahbots.manager.AuctionManager;
import com.vyxel.ahbots.manager.BotNameGenerator;
import com.vyxel.ahbots.manager.ItemLoader;
import lombok.Getter;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;

public class VyxelAHBots extends JavaPlugin {

    @Getter private static VyxelAHBots instance;

    @Getter private Economy economy;
    @Getter private GUIManager guiManager;
    @Getter private ItemLoader itemLoader;
    @Getter private BotNameGenerator botNameGenerator;
    @Getter private AuctionManager auctionManager;

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

        saveDefaultConfig();
        copyDefaultItems();

        if (!setupEconomy()) {
            getLogger().warning("No Vault economy provider found. Purchase features will be disabled.");
        }

        guiManager = new GUIManager();
        itemLoader = new ItemLoader(this);
        botNameGenerator = new BotNameGenerator(this);
        auctionManager = new AuctionManager(this);

        itemLoader.load();
        auctionManager.start();

        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);

        AHBotCommand cmd = new AHBotCommand(this);
        getCommand("vyxelahbots").setExecutor(cmd);
        getCommand("vyxelahbots").setTabCompleter(cmd);

        getLogger().info("VyxelAHBots enabled successfully.");
    }

    @Override
    public void onDisable() {
        if (auctionManager != null) {
            auctionManager.stop();
        }
        getLogger().info("VyxelAHBots disabled.");
    }

    private boolean setupEconomy() {
        if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) return false;
        economy = rsp.getProvider();
        return economy != null;
    }

    private void copyDefaultItems() {
        File itemsFolder = new File(getDataFolder(), "items");
        if (!itemsFolder.exists()) {
            itemsFolder.mkdirs();
            saveResource("items/dirt.yml", false);
            saveResource("items/example.yml", false);
        }
    }

    public void reload() {
        reloadConfig();
        itemLoader.load();
        auctionManager.stop();
        auctionManager.start();
        botNameGenerator.reload();
    }
}