Ibreak Toslol

i need aplugin that acts like a player shop where players can sell their items trough a gui to other players, it should be simple and lightweight, they should be able to cancel their listing by rightclicking the item in the gui, it should use vault as an economy plugin with essentialx, my minecradt version is 1.21.11 make it so everyone has permission to buy and sell, and keep it simple and lightweight anf im using purpur for plugins

Kodari AI
KodariAug 29 at 1:01 am 2
PlayerShopGUI
A lightweight player-to-player shop plugin with a GUI-based marketplace. Players can list items for sale by placing them in a chest GUI, set prices via chat prompts, and browse other players' listings. Buyers can purchase items directly from the GUI using Vault economy integration. Sellers can cancel active listings by right-clicking their items. Uses a simple flat-file storage system for persistence. Permissions are granted to all players by default for buying and selling. Built for Minecraft 1.21.11 with Purpur and EssentialsX compatibility.
  1. Create the Gradle/Purpur plugin setup with Vault and XSeries.

  2. Add persistent listing storage and Vault-backed buy/sell transactions.

  3. Add lightweight marketplace and sell GUIs, including right-click cancellation.

  4. Register the /shop command and inventory event handling with no permission requirements.

Implemented a lightweight GUI player shop plugin.

  • /shop opens the marketplace.

  • /shop sell opens the selling GUI.

  • Players hold an item in their main hand, choose a configured price, and list it.

  • Left-click listings to buy.

  • Right-click your own listing to cancel and retrieve the item.

  • Uses Vault economy, compatible with EssentialsX economy.

  • Listings persist in plugins/PlayerShop/listings.yml.

  • No permissions are required.

  • Includes pagination and configurable price options/messages.

  • Targets Java 21 and Paper API 1.21.1, compatible with Purpur 1.21.1.

Ibreak Toslol

make it so theres no sell gui just sell trough commanf example /shop sell 1000 anf it sells the helf item also change the /shop to /ah

Kodari AI
KodariAug 29 at 1:15 am 1
  1. Replace the sell GUI with /ah sell <price> using the item in the player’s main hand.

  2. Rename the marketplace command from /shop to /ah and update command handling/messages.

  1. Replaced the sell GUI with /ah sell <price>.

    • Sells the entire item stack held in the player’s main hand.

    • Example: /ah sell 1000

    • Validates that the price is a positive number.

  2. Renamed the marketplace command to /ah.

    • /ah opens the auction house.

    • /ah sell <price> lists an item.

    • /shop is no longer registered.

Players can still buy with left-click and cancel their own listings with right-click.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 527
src/main/java/com/kodari/playershop/PlayerShopPlugin.java
package com.kodari.playershop;

import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

public class PlayerShopPlugin extends JavaPlugin implements CommandExecutor {
    private ShopManager shopManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        Economy economy = setupEconomy();
        if (economy == null) {
            getLogger().severe("Vault or an economy provider was not found.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        shopManager = new ShopManager(this, economy);
        Bukkit.getPluginManager().registerEvents(new ShopListener(shopManager), this);
        getCommand("ah").setExecutor(this);
    }

    @Override
    public void onDisable() {
        if (shopManager != null) {
            shopManager.save();
        }
    }

    private Economy setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return null;
        }
        RegisteredServiceProvider<Economy> registration = getServer().getServicesManager().getRegistration(Economy.class);
        return registration == null ? null : registration.getProvider();
    }

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

        if (args.length > 0 && args[0].equalsIgnoreCase("sell")) {
            if (args.length != 2) {
                player.sendMessage("§eUsage: /ah sell <price>");
                return true;
            }

            double price;
            try {
                price = Double.parseDouble(args[1]);
            } catch (NumberFormatException exception) {
                player.sendMessage("§cPrice must be a valid number.");
                return true;
            }

            if (!Double.isFinite(price) || price <= 0) {
                player.sendMessage("§cPrice must be greater than zero.");
                return true;
            }
            shopManager.sellHeldItem(player, price);
        } else {
            shopManager.openShop(player, 0);
        }
        return true;
    }
}