Shaurya Pratap Singh

create a plugin just like aucton house . meening the command /ah should open a double chest with name AUCTION HOUSE on top if the chest inplace of chest

Kodari AI
KodariSep 26 at 9:20 am 1
AuctionHouseGUI
A Bukkit plugin implementing an auction house system. The /ah command opens a double chest inventory titled "AUCTION HOUSE" where players can browse and interact with listed items. Uses a custom GUI framework with lazy initialization, button-based click handlers, and centralized inventory management. Players can view items, place bids, and manage auction listings through an intuitive chest interface. The plugin features automatic event handling, memory-efficient inventory tracking, and reusable GUI components built on the InventoryGUI abstract class.
  1. Add the Gradle project and plugin metadata.

  2. Implement /ah to open a 54-slot inventory titled AUCTION HOUSE.

  3. Keep the inventory interface-only by blocking item movement within it.

Created the AuctionHouse plugin. /ah opens a 54-slot double-chest inventory titled AUCTION HOUSE; item movement is blocked while it’s open.

This provides the requested menu shell only—auction listings, buying, and selling aren’t included.

Shaurya Pratap Singh

make that chest ui look like this

1 image attached
Kodari AI
KodariSep 26 at 9:34 am 1
  • Keep the 45 main slots empty and add the screenshot’s control icons across the bottom row.

  • Preserve the AUCTION HOUSE title and the existing click/drag lock.

Added the screenshot-style bottom row: close barrier, separator panes, anvil, hopper, sign, chest, and fishing rod. The rest of the 54-slot menu stays empty, and clicks remain blocked, so the icons are visual only.

Shaurya Pratap Singh

the barrier is back and arrow is next page

Kodari AI
KodariSep 26 at 9:34 am 1
  • Change the barrier label to Back and use an arrow for Next Page.

Updated the bottom row: the barrier is labeled Back, and the Next Page control is now an arrow.

Shaurya Pratap Singh

barrier is exit i said back sorry

Kodari AI
KodariSep 26 at 9:36 am 1

Changed the barrier’s label to Exit.

Shaurya Pratap Singh

also add the functions so arrow will bring next page the hopper is filter of prise from low to high and high to low and the prises will be taken from the vault plugin if you know

Kodari AI
KodariSep 26 at 9:39 am 1
  1. Make the arrow switch auction pages.

  2. Make the hopper toggle price sorting low-to-high/high-to-low.

  3. Integrate Vault economy for auction prices.

Added working pagination, price sorting, and Vault economy transactions. Use /ah sell <price> while holding an item to list it; the arrow pages through listings, and the hopper toggles low-to-high/high-to-low. Clicking a listing purchases it through Vault and pays the seller.

Vault provides the economy and currency formatting; sellers set their own listing prices. Auctions are currently memory-only and clear when the server restarts. Install Vault and an economy provider, such as EssentialsX Economy.

Shaurya Pratap Singh

the chest is my autions it will open another double chest with lable my auction and it will show the items the player will rase in auctions just like ther auction plugins

Kodari AI
KodariSep 26 at 9:40 am 1
  • Add a separate 54-slot MY AUCTIONS inventory showing only the player’s active listings.

  • Add paging and a back control; keep its item slots display-only and block clicks/drags from moving items.

The Your Auctions chest control now opens a double-chest MY AUCTIONS menu showing the player’s active listings, with paging and a button to return to the auction house. Item movement is blocked in both menus.

Shaurya Pratap Singh

and the sign is search so if anyone wants specific item it can be searched also the phrases should also work like axe rather than full name diami=ond_axe or stone_axe and etc

Kodari AI
KodariSep 26 at 9:42 am 1

I’ll wire the sign to a chat search prompt, filter auction listings by partial item-name matches (including axe), and support clear to remove the filter.

The sign now prompts for a search in chat and filters auctions by partial item names—axe matches items such as diamond axes and stone axes. Type clear to remove the filter.

Shaurya Pratap Singh

now add a new command /ah searchorwhatthesearchcommandis [item name/phrase] [enchantment name or phrase] [level number]

Kodari AI
KodariSep 26 at 9:44 am 1
  • Add /ah search with partial item-name matching and optional enchantment/level filters.

  • Reuse the existing per-player auction search so the menu search and command behave consistently.

  • Update the command usage metadata.

Added /ah search <item phrase> [enchantment phrase] [level]. For example, /ah search diamond axe sharpness 5 matches diamond axes with Sharpness V; item names are partial-match searches. /ah search clear clears the filter.

Shaurya Pratap Singh

let make it more simple /ah <item_phrase> <enchantment> lv

Kodari AI
KodariSep 26 at 9:46 am 1
  1. Make search filters work directly after /ah while retaining /ah sell, /ah clear, and the existing /ah search alias.

  2. Update command usage to show the shorter syntax.

Search now works without the search keyword: /ah diamond axe sharpness 5. You can also search by item phrase alone, use /ah clear to reset, and /ah search ... remains supported.

Shaurya Pratap Singh

i meen diamond axe should not have space in between them let it be typed as diamond_axe 0r any item with space should be wrotten as _ insted of space

Kodari AI
KodariSep 26 at 9:47 am 1
  • Normalize underscores in the item phrase to spaces before filtering.

  • Update command usage to show underscore-separated item names.

Updated search to accept underscore-separated item names, e.g. /ah diamond_axe; underscores are normalized to spaces for matching. Command usage now shows the underscore format.

Shaurya Pratap Singh

please give the summery till here

Kodari AI
KodariSep 27 at 5:25 am 1

Auction House summary

  • Main auction menu

    • Arrow buttons change pages.

    • Hopper toggles price sorting between low-to-high and high-to-low.

    • Barrier is labeled Exit.

    • Sign opens a chat search prompt; partial item names work, so axe can match diamond and stone axes.

  • My Auctions

    • The chest control opens a separate double-chest menu labeled My Auctions, showing the player’s active listings.

    • Includes paging and a back button. Items in the menu can’t be moved.

  • Listings and payments

    • Use /ah sell <price> while holding an item to list it.

    • Vault handles purchases and paying sellers. Vault and an economy provider, such as EssentialsX Economy, must be installed.

    • Listings are currently stored in memory and are lost when the server restarts.

  • Search command

    • Search directly with /ah <item_phrase> [enchantment] [level].

    • Separate words in item names with underscores, for example: /ah diamond_axe sharpness 5.

    • Item phrases can be partial. /ah clear clears the search; /ah search ... remains an alias.

Shaurya Pratap Singh

now add my sql support for auction so it can be synced across servers

Kodari AI
KodariSep 27 at 5:28 am 1
  1. Check the current auction/listing flow and project dependencies.

  2. Add configurable MySQL storage and cross-server listing synchronization, then wire it into startup/shutdown.

Added MySQL-backed auction storage with automatic table creation. Listings persist across restarts and sync between servers every 3 seconds; purchases claim a listing in MySQL so two servers can’t sell it simultaneously.

Configure the same MySQL host, database, username, password, and table on every server in config.yml, and ensure each server has Vault plus an economy provider. New listings will be stored in the shared database.

Shaurya Pratap Singh

hey i am getting this error

1 image attached
Kodari AI
KodariSep 27 at 5:28 am 1

The error is that Vault is installed, but there’s no economy plugin providing balances. Vault is only the bridge; it doesn’t add an economy by itself, so AuctionHouse disables when it can’t find one.

Install an economy provider such as EssentialsX, then restart the server. The Homebound permission/storage warnings are separate and aren’t causing this AuctionHouse error. MySQL configuration won’t resolve it either.

Shaurya Pratap Singh

change the ui to this of my auction chest also the barrir is to go back to main auction chest , paper is to toggle between normal and delinting so if changed to delisting selecting any item will then ask yes or no to delist from auction and chect will show the auction history with barrier for go back and arrowa to next and previous page also the item shorting in history will be like rescent first and old at last

1 image attached
Kodari AI
KodariSep 27 at 5:36 am 1
  • Update My Auctions controls to match the screenshot: barrier back, paper mode toggle, chest history, and page arrows.

  • Add a yes/no confirmation flow for delisting; confirmed items return to the seller.

  • Persist sold and delisted listings in MySQL history, shown newest-first with pagination.

Updated My Auctions with the requested controls: barrier returns to the main auction house, paper toggles Normal/Delisting mode, and chest opens auction history. In Delisting mode, selecting a listing opens a Yes/No confirmation; confirming removes it from the auction and returns the item to the seller.

Sold and delisted auctions are saved in a shared MySQL history table and shown newest-first with previous/next page arrows. History starts accumulating after this update; sales from before the history table existed won’t appear.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
9 999
src/main/java/com/kodari/auctionhouse/AuctionHousePlugin.java
package com.kodari.auctionhouse;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XEnchantment;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class AuctionHousePlugin extends JavaPlugin implements Listener {
    private static final String INVENTORY_TITLE = ChatColor.GOLD + "AUCTION HOUSE";
    private static final String MY_AUCTIONS_TITLE = ChatColor.GOLD + "MY AUCTIONS";
    private static final String AUCTION_HISTORY_TITLE = ChatColor.GOLD + "AUCTION HISTORY";
    private static final String DELIST_CONFIRM_TITLE = ChatColor.GOLD + "CONFIRM DELIST";
    private static final int AUCTIONS_PER_PAGE = 45;
    private final Map<UUID, Integer> playerPages = new HashMap<>();
    private final Map<UUID, Integer> myAuctionPages = new HashMap<>();
    private final Map<UUID, Integer> historyPages = new HashMap<>();
    private final Map<UUID, Boolean> ascendingPriceSort = new HashMap<>();
    private final Map<UUID, Boolean> delistingMode = new HashMap<>();
    private final Map<UUID, AuctionListing> pendingDelistings = new HashMap<>();
    private final Map<UUID, AuctionSearch> auctionSearches = new HashMap<>();
    private final Set<UUID> awaitingAuctionSearch = ConcurrentHashMap.newKeySet();
    private final List<AuctionListing> listings = new ArrayList<>();
    private MySqlAuctionStorage storage;
    private ExecutorService databaseExecutor;
    private Economy economy;
    private boolean storageReady;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        RegisteredServiceProvider<Economy> registration = getServer().getServicesManager().getRegistration(Economy.class);
        if (registration == null || registration.getProvider() == null) {
            getLogger().severe("Vault is installed, but no economy provider is available.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        economy = registration.getProvider();

        try {
            storage = new MySqlAuctionStorage(
                    getConfig().getString("mysql.host", "localhost"),
                    getConfig().getInt("mysql.port", 3306),
                    getConfig().getString("mysql.database", "auctionhouse"),
                    getConfig().getString("mysql.username", "root"),
                    getConfig().getString("mysql.password", ""),
                    getConfig().getString("mysql.table", "auction_listings"));
        } catch (IllegalArgumentException exception) {
            getLogger().severe("Invalid MySQL configuration: " + exception.getMessage());
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        databaseExecutor = Executors.newSingleThreadExecutor(runnable -> {
            Thread thread = new Thread(runnable, "AuctionHouse-MySQL");
            thread.setDaemon(true);
            return thread;
        });

        getCommand("ah").setExecutor((sender, command, label, args) -> {
            if (!(sender instanceof Player player)) {
                sender.sendMessage("Only players can use the auction house.");
                return true;
            }

            if (!storageReady) {
                player.sendMessage(ChatColor.YELLOW + "Auction data is still connecting. Try again shortly.");
                return true;
            }

            if (args.length == 0) {
                openAuctionHouse(player, 1);
            } else if (args.length == 2 && args[0].equalsIgnoreCase("sell")) {
                createListing(player, args[1]);
            } else if (args[0].equalsIgnoreCase("search")) {
                searchAuctions(player, args, 1);
            } else {
                searchAuctions(player, args, 0);
            }
            return true;
        });
        Bukkit.getPluginManager().registerEvents(this, this);

        databaseExecutor.execute(() -> {
            try {
                storage.initialize();
                List<AuctionListing> initialListings = storage.loadListings();
                runOnMain(() -> {
                    listings.clear();
                    listings.addAll(initialListings);
                    storageReady = true;
                    long intervalTicks = Math.max(20L, getConfig().getLong("mysql.sync-interval-seconds", 3L) * 20L);
                    Bukkit.getScheduler().runTaskTimer(this, this::refreshListings, intervalTicks, intervalTicks);
                    getLogger().info("Connected to MySQL and loaded " + listings.size() + " auction listings.");
                });
            } catch (Exception exception) {
                getLogger().log(java.util.logging.Level.SEVERE, "Could not initialize MySQL auction storage.", exception);
                runOnMain(() -> Bukkit.getPluginManager().disablePlugin(this));
            }
        });
    }

    @Override
    public void onDisable() {
        if (databaseExecutor != null) {
            databaseExecutor.shutdown();
        }
    }

    private void runOnMain(Runnable action) {
        if (isEnabled()) {
            Bukkit.getScheduler().runTask(this, () -> {
                if (isEnabled()) {
                    action.run();
                }
            });
        }
    }

    private void refreshListings() {
        if (!storageReady || databaseExecutor == null || databaseExecutor.isShutdown()) {
            return;
        }
        databaseExecutor.execute(() -> {
            try {
                List<AuctionListing> latestListings = storage.loadListings();
                runOnMain(() -> {
                    listings.clear();
                    listings.addAll(latestListings);
                });
            } catch (Exception exception) {
                getLogger().log(java.util.logging.Level.WARNING, "Could not sync auction listings from MySQL.", exception);
            }
        });
    }

    private void createListing(Player player, String priceArgument) {
        double price;
        try {
            price = Double.parseDouble(priceArgument);
        } catch (NumberFormatException exception) {
            player.sendMessage(ChatColor.RED + "Enter a valid price.");
            return;
        }
        if (!Double.isFinite(price) || price <= 0) {
            player.sendMessage(ChatColor.RED + "Price must be greater than zero.");
            return;
        }

        ItemStack item = player.getInventory().getItemInMainHand();
        if (item.getType().isAir()) {
            player.sendMessage(ChatColor.RED + "Hold the item you want to auction.");
            return;
        }

        AuctionListing listing = new AuctionListing(UUID.randomUUID(), player.getUniqueId(), item.clone(), price);
        player.getInventory().setItemInMainHand(null);
        databaseExecutor.execute(() -> {
            try {
                storage.insertListing(listing);
                runOnMain(() -> {
                    if (player.isOnline()) {
                        player.sendMessage(ChatColor.GREEN + "Listed your item for " + economy.format(price) + ".");
                    }
                    refreshListings();
                });
            } catch (Exception exception) {
                getLogger().log(java.util.logging.Level.SEVERE, "Could not save an auction listing to MySQL.", exception);
                runOnMain(() -> {
                    if (player.isOnline()) {
                        Map<Integer, ItemStack> remaining = player.getInventory().addItem(listing.item().clone());
                        for (ItemStack returnedItem : remaining.values()) {
                            player.getWorld().dropItemNaturally(player.getLocation(), returnedItem);
                        }
                        player.sendMessage(ChatColor.RED + "The listing could not be saved; your item was returned.");
                    }