yotek.3

Develop a comprehensive shop plugin that features a user-friendly INVENTORY GUI for purchasing and selling a wide variety of items, including custom items and blocks. Integrate a robust economy system using Vault, allow admins to set adjustable prices, and implement a category system for easy navigation. Additionally, include permissions for user roles, sale notifications, and customizable shop locations for a more immersive experience.

Kodari AI
KodariApr 17 at 5:13 pm 52,597 (v2)
ComprehensiveShop
A feature-rich GUI shop plugin with Vault economy integration. Players browse categorized items (Blocks, Ores, Food, Farming, Misc, Building) through a layered inventory GUI — main menu → category → confirm screen with adjustable quantity. Supports left-click buying, right-click selling, sale notifications (personal or broadcast), shop sign interaction for immersive locations, and full admin control over prices, shop locations, and config reloading.

Planning all class dependencies before writing:

  • Main plugin → holds ConfigManager, EconomyManager, ShopManager, GUIManager

  • GUI chain: MainShopGUI → CategoryGUI → ConfirmGUI (paginated, all 54/27 slots always covered to avoid stale buttons)

  • ShopManager owns transaction logic (processBuy/processSell), location checks, price updates, notifications

  • EconomyManager wraps Vault, ConfigManager wraps file config, ItemBuilder wraps XMaterial

  • ConfirmGUI captures final int finalAmount each decorate() call — amount change re-decorates in-place

  • All 54/27 slots explicitly set every decorate() call; clearButtons() added to base class

ComprehensiveShop is complete — 6 item categories (Blocks, Ores, Food, Farming, Misc, Building) with a three-layer GUI (main menu → paginated category → amount-picker confirm screen), left-click buy / right-click sell, Vault economy integration, per-sign shop locations, broadcast/personal sale notifications, and full admin commands (/shopadmin setbuy, setsell, addlocation, removelocation, listlocations, reload) with tab-completion throughout.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
22 1,887
src/main/java/com/comprehensiveshop/ComprehensiveShop.java
package com.comprehensiveshop;

import com.comprehensiveshop.command.ShopAdminCommand;
import com.comprehensiveshop.command.ShopCommand;
import com.comprehensiveshop.config.ConfigManager;
import com.comprehensiveshop.inventory.gui.GUIListener;
import com.comprehensiveshop.inventory.gui.GUIManager;
import com.comprehensiveshop.listener.ShopListener;
import com.comprehensiveshop.manager.EconomyManager;
import com.comprehensiveshop.manager.ShopManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class ComprehensiveShop extends JavaPlugin {

    private ConfigManager configManager;
    private EconomyManager economyManager;
    private ShopManager shopManager;
    private GUIManager guiManager;

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

        configManager = new ConfigManager(this);
        economyManager = new EconomyManager(this);

        if (!economyManager.setup()) {
            getLogger().severe("Vault not found or no economy plugin detected! Disabling ComprehensiveShop.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        shopManager = new ShopManager(this);
        guiManager = new GUIManager();

        getServer().getPluginManager().registerEvents(new GUIListener(guiManager), this);
        getServer().getPluginManager().registerEvents(new ShopListener(this), this);

        ShopCommand shopCmd = new ShopCommand(this);
        ShopAdminCommand shopAdminCmd = new ShopAdminCommand(this);

        getCommand("shop").setExecutor(shopCmd);
        getCommand("shop").setTabCompleter(shopCmd);
        getCommand("shopadmin").setExecutor(shopAdminCmd);
        getCommand("shopadmin").setTabCompleter(shopAdminCmd);

        getLogger().info("ComprehensiveShop v" + getDescription().getVersion() + " enabled successfully.");
    }

    @Override
    public void onDisable() {
        getLogger().info("ComprehensiveShop disabled.");
    }
}