nacho_ninja1
📎 1 file 3,745 chars
📄
pasted-code-1790881988164.txt
txt 209 lines
▶
My shop plugin does NOT work when I add it to my server.

I want you to **completely rebuild and fix the shop plugin from scratch**, not just give me small patches.

Target server:

**Paper 1.21.11**
**Java 21**
**Maven**

Plugin name:

**WaffleShop**

## 🧇 MAIN REQUIREMENT

The command:

`/shop`

MUST actually work in-game and open the shop GUI.

Make sure the command is properly registered in `plugin.yml` and that the plugin loads correctly on Paper 1.21.11.

There must be NO missing commands, classes, dependencies, configuration files, or broken listeners.

## 🧇 WAFFLE SHOP GUI

Create a professional shop GUI with:

**🧇 WAFFLE SHOP**

Use a premium WAFFLE SMP theme:

* Brown
* Gold
* Cream
* Yellow

Do NOT use cyan, purple, or rainbow colors.

## CATEGORIES

The main shop should have clickable categories:

🧱 BLOCKS
🍎 FOOD
⚔️ GEAR
🔥 NETHER
💎 SHARDS

Clicking a category must actually open its corresponding shop.

Add a working **Back** button to return to the main shop.

## BLOCKS SHOP

Make the Blocks category fully functional.

Add configurable items such as:

* Stone
* Cobblestone
* Dirt
* Grass Block
* Sand
* Gravel
* Oak Log
* Spruce Log
* Birch Log
* Glass
* Bricks
* Stone Bricks
* Obsidian

Every item needs:

* Buy price
* Sell price
* Amount
* Material
* Display name
* Lore
* Slot

## BUYING AND SELLING

When a player clicks an item, provide a working buy/sell interface.

Buying must:

1. Check the player's Vault balance.
2. Check inventory space.
3. Remove the correct amount of money.
4. Give the correct item.
5. Send a confirmation message.

Selling must:

1. Check the player has the item.
2. Remove the correct amount.
3. Give the player the correct amount of money.
4. Send a confirmation message.

Do NOT create fake buttons that don't actually perform the transaction.

## VAULT

Use Vault properly.

Make sure Vault is declared correctly as a dependency/soft-dependency where appropriate.

The plugin must safely handle Vault not being installed.

Do NOT crash the entire plugin if Vault is missing. Give a clear console message explaining what is required.

## CONFIGURATION

Create working configuration files:

`config.yml`

`categories.yml`

`blocks.yml`

`food.yml`

`gear.yml`

`nether.yml`

`shards.yml`

All shop items and prices must be configurable without editing Java.

## COMMANDS

Register:

`/shop`

`/waffleshop reload`

Make sure `/shop` appears in the command system and actually works.

Add proper permissions.

## ERROR PREVENTION

Before giving me the final project, check for:

* Missing `plugin.yml` commands
* Incorrect package names
* Missing imports
* Missing classes
* Invalid Paper 1.21.11 APIs
* Incorrect Vault setup
* Broken configuration paths
* Inventory click errors
* Null pointer errors
* Incorrect material names
* Incorrect Maven dependencies
* Plugin startup errors

## VERY IMPORTANT

The plugin must successfully enable when placed in:

`plugins/`

The console should show something like:

`[WaffleShop] WaffleShop enabled successfully!`

If something required is missing, clearly explain it instead of silently failing.

## BUILD

Give me the COMPLETE Maven source project.

Include:

`pom.xml`

`plugin.yml`

All Java classes

All YAML configuration files

README

Then verify that the project builds successfully with:

`mvn clean package`

The final JAR must be:

**WaffleShop.jar**

Do NOT give me pseudocode.

Do NOT give me incomplete code.

Do NOT tell me to "fill in the missing parts".

Give me a complete working Paper 1.21.11 plugin.
Kodari AI
KodariOct 1 at 7:19 pm 2
WaffleShop
A complete Paper 1.21.11 shop plugin featuring a premium waffle-themed GUI with brown, gold, cream, and yellow colors. Includes a main shop with five clickable categories (Blocks, Food, Gear, Nether, Shards), each with fully configurable items via YAML files. Implements working buy/sell transactions using Vault economy with proper balance checks, inventory space validation, and confirmation messages. Features a functional back button, /shop command, /waffleshop reload command, and permission-based access. Safely handles missing Vault dependency with clear console messages, ensuring the plugin enables successfully on Paper 1.21.11 with Java 21 and Maven build support.
  1. Create the Maven build and Paper plugin metadata for WaffleShop.

  2. Implement the Vault-aware commands, configurable shop menus, and safe buy/sell transactions.

  3. Add all requested YAML configs and setup/build instructions.

Created the complete WaffleShop Maven project with the /shop GUI, configurable category and item files, /waffleshop reload, and Vault-backed buy/sell transactions. Vault is optional at startup; without an economy provider, the plugin stays enabled and transactions show a clear message.

The build is configured to produce target/WaffleShop.jar. I couldn’t run mvn clean package in this environment, so I can’t confirm a successful Maven build.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
16 1,225
src/main/java/com/waffle/waffleshop/WaffleShopPlugin.java
package com.waffle.waffleshop;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.util.Collections;
import java.util.List;

public final class WaffleShopPlugin extends JavaPlugin implements CommandExecutor, TabCompleter {
    private ShopManager shopManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResourceIfMissing("categories.yml");
        saveResourceIfMissing("blocks.yml");
        saveResourceIfMissing("food.yml");
        saveResourceIfMissing("gear.yml");
        saveResourceIfMissing("nether.yml");
        saveResourceIfMissing("shards.yml");

        PluginCommand shopCommand = getCommand("shop");
        PluginCommand adminCommand = getCommand("waffleshop");
        if (shopCommand == null || adminCommand == null) {
            getLogger().severe("Required commands are missing from plugin.yml; disabling WaffleShop.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        shopCommand.setExecutor(this);
        adminCommand.setExecutor(this);
        adminCommand.setTabCompleter(this);

        EconomyAccess economy = findEconomy();
        if (economy == null) {
            getLogger().warning("Vault or a Vault economy provider is unavailable. Shop transactions require Vault and an economy plugin; the plugin will remain enabled.");
        }

        shopManager = new ShopManager(this, economy);
        Bukkit.getPluginManager().registerEvents(shopManager, this);
        shopManager.reload();
        getLogger().info("WaffleShop enabled successfully!");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("shop")) {
            if (!sender.hasPermission("waffleshop.use")) {
                sender.sendMessage(color(getConfig().getString("prefix", "")
                        + getConfig().getString("messages.no-permission", "&cYou do not have permission.")));
                return true;
            }
            if (!(sender instanceof Player player)) {
                sender.sendMessage(color(getConfig().getString("prefix", "")
                        + getConfig().getString("messages.player-only", "&cThis command can only be used in-game.")));
                return true;
            }
            if (args.length != 0) {
                player.sendMessage(color(getConfig().getString("prefix", "")
                        + getConfig().getString("messages.usage", "&eUse /shop.")));
                return true;
            }
            shopManager.openMain(player);
            return true;
        }

        if (command.getName().equalsIgnoreCase("waffleshop")) {
            if (!sender.hasPermission("waffleshop.admin")) {
                sender.sendMessage(color(getConfig().getString("prefix", "")
                        + getConfig().getString("messages.no-permission", "&cYou do not have permission.")));
                return true;
            }
            if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
                reloadConfig();
                shopManager.reload();
                sender.sendMessage(color(getConfig().getString("prefix", "")
                        + getConfig().getString("messages.reloaded", "&aConfiguration reloaded.")));
                return true;
            }
            sender.sendMessage(color(getConfig().getString("prefix", "")
                    + getConfig().getString("messages.admin-usage", "&eUse /waffleshop reload.")));
            return true;
        }
        return false;
    }

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        if (command.getName().equalsIgnoreCase("waffleshop")
                && sender.hasPermission("waffleshop.admin")
                && args.length == 1
                && "reload".startsWith(args[0].toLowerCase())) {
            return List.of("reload");
        }
        return Collections.emptyList();
    }

    private EconomyAccess findEconomy() {
        if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
            return null;
        }
        try {
            Class<?> hook = Class.forName("com.waffle.waffleshop.VaultEconomyAccess", true, getClass().getClassLoader());
            return (EconomyAccess) hook.getMethod("hook", WaffleShopPlugin.class).invoke(null, this);
        } catch (ReflectiveOperationException | LinkageError error) {
            getLogger().warning("Vault was detected but its economy API could not be loaded. Shop transactions are unavailable.");
            return null;
        }
    }

    private void saveResourceIfMissing(String name) {
        File file = new File(getDataFolder(), name);
        if (!file.exists()) {
            saveResource(name, false);
        }
    }

    private String color(String message) {
        return org.bukkit.ChatColor.translateAlternateColorCodes('&', message);
    }
}