Leonardo9221

I want to make donut auction plugin the ender chest is quick buy from auction normal chest is list items anvil is to refresh auction and sign is to search item and hoper is filter

[Viewing 4 images]

Kodari AI
KodariNov 15 at 11:50 am 3
DonutAuctionHouse
A Minecraft plugin that transforms a physical auction house building into an interactive marketplace. Players place items for auction using chests, with the ender chest serving as a quick-buy interface for purchasing listed items. The anvil refreshes the auction listings, signs enable item searching by name, and hoppers filter items by category. The plugin provides a GUI-based auction system where players can browse, search, filter, and purchase items from other players, with automatic listing updates and a user-friendly inventory interface for managing auctions.
  • Build the auction menu with listing, quick-buy, refresh, search, and filter controls.

  • Store listings across restarts and use Vault for payments. Search will use chat input rather than the pictured dialog.

Built the auction house with persistent listings, quick buy, search, sorting, and listing management.

  • Use /auction to browse and /auction sell <price> to list the held stack.

  • Search uses chat input rather than the pictured dialog.

  • Requires Vault and an economy provider.

Leonardo9221

i want to make pause menu and when i pres G it openss

Kodari AI
KodariNov 15 at 12:02 pm 1

This is a Minecraft server plugin project, but detecting the G key and opening a client pause menu requires a client mod. Kodari supports Fabric mods for Minecraft 26.3, 26.2, 1.21.11, 1.21.4, 1.20.4, 1.19.4, and 1.18.2. Which version would you like?

Leonardo9221

i play paper 26.3

Kodari AI
KodariNov 15 at 12:03 pm 1

Paper 26.3 plugins can’t detect the G key by themselves. You can use a Fabric 26.3 client mod alongside your Paper server; Kodari supports that.

Switch to Fabric 26.3

Leonardo9221

just meke it without G

Kodari AI
KodariNov 15 at 12:04 pm 2

I’ll add a /pause menu with buttons to resume, open the auction, and manage your listings. It won’t pause the multiplayer server.

Added /pause with buttons for Resume, Quick Buy, Auction, and Your Items.

The menu doesn’t pause the multiplayer server.

Leonardo9221

i want it bee when i pres ESC

Kodari AI
KodariNov 15 at 12:08 pm 1

A Paper plugin can’t detect Esc or replace Minecraft’s built-in pause menu. That requires a client mod; Kodari supports Fabric 26.3 alongside your Paper server.

Switch to Fabric 26.3

Leonardo9221

ok

Kodari AI
KodariNov 15 at 12:08 pm 1

To build the Esc menu as a client mod, switch this project to Fabric 26.3:

Switch to Fabric 26.3

Leonardo9221

noo

Kodari AI
KodariNov 15 at 12:09 pm 1

We can keep it as a Paper plugin. The /pause menu will work, but a plugin can’t open it when you press Esc.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
4 428
src/main/java/com/kodari/auction/DonutAuction.java
package com.kodari.auction;

import com.cryptomorin.xseries.XMaterial;
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.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
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.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

public final class DonutAuction extends JavaPlugin implements Listener {
    private final Map<UUID, Listing> listings = new HashMap<>();
    private final Map<UUID, Boolean> searching = new ConcurrentHashMap<>();
    private Economy economy;
    private File dataFile;

    private static final class Listing {
        final UUID id;
        final UUID seller;
        final String sellerName;
        final ItemStack item;
        final double price;
        final long created;

        Listing(UUID id, UUID seller, String sellerName, ItemStack item, double price, long created) {
            this.id = id;
            this.seller = seller;
            this.sellerName = sellerName;
            this.item = item;
            this.price = price;
            this.created = created;
        }
    }

    private static final class Menu implements InventoryHolder {
        final String mode;
        final String query;
        final int sort;
        final int page;
        final Map<Integer, UUID> entries = new HashMap<>();
        Inventory inventory;

        Menu(String mode, String query, int sort, int page) {
            this.mode = mode;
            this.query = query;
            this.sort = sort;
            this.page = page;
        }

        @Override
        public Inventory getInventory() {
            return inventory;
        }
    }

    @Override
    public void onEnable() {
        saveDefaultConfig();
        RegisteredServiceProvider<Economy> provider = getServer().getServicesManager().getRegistration(Economy.class);
        if (provider == null || provider.getProvider() == null) {
            getLogger().severe("Vault requires an economy provider; disabling auction.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        economy = provider.getProvider();
        dataFile = new File(getDataFolder(), "listings.yml");
        loadListings();
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        if (dataFile != null) saveListings();
    }

    private void loadListings() {
        YamlConfiguration yaml = YamlConfiguration.loadConfiguration(dataFile);
        ConfigurationSection section = yaml.getConfigurationSection("listings");
        if (section == null) return;
        for (String key : section.getKeys(false)) {
            try {
                String path = "listings." + key + ".";
                UUID id = UUID.fromString(key);
                UUID seller = UUID.fromString(yaml.getString(path + "seller", ""));
                ItemStack item = yaml.getItemStack(path + "item");
                double price = yaml.getDouble(path + "price");
                if (item != null && Double.isFinite(price) && price > 0) {
                    listings.put(id, new Listing(id, seller, yaml.getString(path + "seller-name", "Unknown"), item, price, yaml.getLong(path + "created")));
                }
            } catch (IllegalArgumentException ex) {
                getLogger().warning("Skipping invalid listing " + key);
            }
        }
    }

    private boolean saveListings() {
        YamlConfiguration yaml = new YamlConfiguration();
        for (Listing listing : listings.values()) {
            String path = "listings." + listing.id + ".";
            yaml.set(path + "seller", listing.seller.toString());
            yaml.set(path + "seller-name", listing.sellerName);
            yaml.set(path + "item", listing.item);
            yaml.set(path + "price", listing.price);
            yaml.set(path + "created", listing.created);
        }
        try {
            yaml.save(dataFile);
            return true;
        } catch (IOException ex) {
            getLogger().severe("Could not save auction listings: " + ex.getMessage());
            return false;
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players can use the auction.");
            return true;
        }
        Player player = (Player) sender;
        if (command.getName().equalsIgnoreCase("pause")) {
            openPause(player);
            return true;
        }
        if (args.length == 0) {
            open(player, "auction", "", 0, 0);
        } else if (args[0].equalsIgnoreCase("sell")) {
            if (args.length != 2) {
                player.sendMessage("§cUsage: /" + label + " sell <price>");
                return true;
            }
            double price;
            try {
                price = Double.parseDouble(args[1]);
            } catch (NumberFormatException ex) {
                player.sendMessage("§cEnter a valid price.");
                return true;
            }
            if (!Double.isFinite(price) || price <= 0 || price > 1000000000000D) {
                player.sendMessage("§cPrice must be greater than zero and at most 1 trillion.");
                return true;
            }
            ItemStack held = player.getInventory().getItemInMainHand();
            if (held.getType().isAir() || held.getAmount() <= 0) {
                player.sendMessage("§cHold the item you want to sell.");
                return true;
            }
            long count = listings.values().stream().filter(l -> l.seller.equals(player.getUniqueId())).count();
            if (count >= Math.max(1, getConfig().getInt("max-listings-per-player", 18))) {
                player.sendMessage("§cYou have reached your listing limit.");
                return true;
            }
            Listing listing = new Listing(UUID.randomUUID(), player.getUniqueId(), player.getName(), held.clone(), price, System.currentTimeMillis());
            listings.put(listing.id, listing);
            if (!saveListings()) {
                listings.remove(listing.id);
                player.sendMessage("§cCould not save your listing. Your item was not taken.");
                return true;
            }
            player.getInventory().setItemInMainHand(null);
            player.sendMessage("§aListed your item for " + economy.format(price) + ".");
        } else if (args[0].equalsIgnoreCase("search")) {
            String query = args.length > 1 ? String.join(" ", Arrays.copyOfRange(args, 1, args.length)) : "";
            if (query.isEmpty()) beginSearch(player);
            else open(player, "auction", query, 0, 0);
        } else {
            player.sendMessage("§e/auction §7- Browse listings");
            player.sendMessage("§e/auction sell <price> §7- List the stack in your hand");
            player.sendMessage("§e/auction search <item> §7- Search listings");
        }