n0trando_07002
📎 1 file 6,904 chars
📄
pasted-code-1786825429163.txt
txt 365 lines
▶
Create a **complete, production-ready Minecraft Paper plugin** for my **Diamonds SMP** server.

## SERVER

* Platform: **Paper**
* Minecraft version: **1.21.11**
* Java
* The final project must compile into a working `.jar`.
* Do NOT give me pseudocode, placeholders, or incomplete code.
* I want a plugin that works **immediately after putting the `.jar` into the `plugins` folder**.
* I do **NOT** want to manually configure anything for the basic plugin to work.

## 1. ECONOMY

Create an internal economy called **Diamonds**.

Commands:

```text
/balance
/bal
/pay  

/eco give  
/eco take  
/eco set  
/eco reset 
```

* `/balance` and `/bal` show the player's balance.
* `/pay` transfers Diamonds between players.
* `/eco` commands are admin-only.
* Store balances persistently using SQLite.
* Automatically create the database on first startup.
* Automatically create all required files/folders.
* No manual setup should be necessary.

## 2. `/SHOP`

Create a professional clickable INVENTORY GUI shop opened with:

```text
/shop
```

The shop must work immediately with **default prices already built into the plugin**.

### Combat

Sell:

* Diamond Sword
* Diamond Axe
* Mace
* Bow
* Arrow
* Shield
* Cobweb
* Breeze Rod

### Armor

Sell:

* Diamond Helmet
* Diamond Chestplate
* Diamond Leggings
* Diamond Boots

### Consumables

Sell:

* Golden Apple
* Strength Potion
* Speed Potion
* Fire Resistance Potion
* Food

### Utility

Sell:

* Water Bucket
* Building Blocks

Players click an item and purchase it using their Diamonds.

The INVENTORY GUI must:

* Prevent taking shop items.
* Prevent shift-click exploits.
* Prevent drag exploits.
* Check the player's balance server-side.
* Remove the correct amount of currency.
* Give the purchased item.
* Display a purchase confirmation.
* Display an insufficient-funds message.
* Have Back and Close buttons.
* Support buying multiple quantities where appropriate.

## 3. DEFAULT PRICES

Use sensible default prices so the plugin works without configuration.

For example:

```yaml
diamond_sword: 100
diamond_axe: 80
mace: 500
bow: 100
arrow: 5
shield: 75
cobweb: 25
breeze_rod: 15
diamond_helmet: 150
diamond_chestplate: 250
diamond_leggings: 225
diamond_boots: 150
golden_apple: 100
strength_potion: 150
speed_potion: 150
fire_resistance_potion: 150
```

You may balance the remaining prices appropriately.

The plugin should automatically generate a `config.yml` containing these defaults, but **the server owner must not need to edit it**.

## 4. `/KIT`

Create:

```text
/kit
```

This should open a professional INVENTORY GUI showing the **Diamonds SMP Kit**.

The kit contains:

* Full Diamond Armor
* Diamond Sword
* Diamond Axe
* Mace
* Bow
* Arrows
* Shield
* Cobwebs
* Strength Potion
* Speed Potion
* Golden Apples
* Water Bucket
* **64 Breeze Rods**
* Blocks
* Food

The kit must have a sensible cooldown.

Automatically create the cooldown system and store it persistently.

## 5. FULL ENCHANTMENTS

This is extremely important.

All weapons, tools, bows, and armor included in the kit should come **already enchanted with the best appropriate enchantments** for their item.

### Exceptions

Do NOT put:

* **Thorns**
* **Knockback**

on any kit item.

Use the strongest **legitimate and compatible** enchantments available for each item on **Minecraft 1.21.11**.

Examples:

### Diamond Sword

Give appropriate max-level combat enchantments, but:

* No Knockback
* No Thorns

### Diamond Axe

Give appropriate max-level axe enchantments.

### Mace

Give the strongest legitimate mace enchantments available on 1.21.11.

### Bow

Give appropriate max-level bow enchantments.

### Diamond Armor

Give appropriate max-level armor enchantments.

* No Thorns.

Do NOT use impossible or incompatible enchantment combinations.

## 6. KIT ITEM DETAILS

Make sure the kit gives the exact intended items.

Important:

```text
Breeze Rods = 64
```

Do not give one Breeze Rod.

Do not give unlimited Breeze Rods.

All item amounts should be reasonable and predefined.

## 7. ECONOMY + SHOP INTEGRATION

The shop must use the same economy system.

Example:

Player has:

```text
1000 Diamonds
```

Player buys:

```text
Mace = 500 Diamonds
```

New balance:

```text
500 Diamonds
```

The transaction must be atomic and safe against duplication or double purchases.

## 8. NO MANUAL CONFIGURATION

This is a major requirement.

After installing the plugin:

1. Start the server.
2. Plugin automatically creates its database.
3. Plugin automatically creates its default configuration.
4. `/shop` works.
5. `/kit` works.
6. `/balance` works.
7. `/pay` works.
8. Economy works.

I should **not have to manually edit any YAML file** for the plugin to function.

Configuration should only exist for optional customization.

## 9. SECURITY

Make the plugin production-quality.

Prevent:

* Item duplication
* INVENTORY GUI item stealing
* Shift-click exploits
* Drag exploits
* Double-click exploits
* Negative economy values
* Invalid purchase amounts
* Exploiting disconnected INVENTORY GUI sessions
* Client-side manipulation of shop prices

All important transactions must be validated server-side.

## 10. PERMISSIONS

Use:

```text
diamondssmp.eco.admin
```

for:

```text
/eco
```

Normal players should be able to use:

```text
/shop
/kit
/balance
/bal
/pay
```

## 11. COMMAND TAB COMPLETION

Add tab completion where appropriate for:

```text
/pay
/eco
```

## 12. CODE QUALITY

Use:

* Clean Java architecture
* Separate classes for economy, shop, kits, INVENTORY GUI, commands, database, and utilities where appropriate.
* Modern Paper API for 1.21.11.
* Proper error handling.
* No unnecessary dependencies.
* SQLite persistence.
* Clear comments for important systems.

## 13. REQUIRED DELIVERABLES

Provide the **entire project**, including:

```text
pom.xml
plugin.yml
config.yml
All Java source files
Database classes
INVENTORY GUI classes
Command classes
Kit system
Economy system
Shop system
```

Also provide:

1. Complete project structure.
2. Exact compilation command.
3. Exact installation instructions.
4. Any required dependencies.
5. Make sure the final `.jar` works on **Paper 1.21.11**.

## FINAL REQUIREMENT

Do not give me a simplified example.

I want the **complete working plugin source code** for a real Diamonds SMP server.

The plugin must work immediately after installation with **zero manual configuration required** for the basic economy, `/shop`, and `/kit` systems.
Kodari AI
KodariAug 15 at 8:26 pm 2
DiamondsSMPCore
A complete Paper plugin providing an internal Diamonds-based economy with persistent SQLite storage, a fully-featured inventory GUI shop with server-side transaction validation, and an enchanted kit system with persistent cooldowns. Includes admin economy commands, player pay/balance commands, tab completion, and comprehensive exploit prevention for a production-ready Diamonds SMP server.
  1. Create the Maven Paper project and default configuration.

  2. Add SQLite persistence and the internal Diamonds economy.

  3. Add secure shop and kit inventory GUIs with listeners.

  4. Add commands, permissions, tab completion, and plugin registration.

Created the complete DiamondsSMP Paper plugin project.

  • Maven project targeting Paper 1.21.11 and Java 21.

  • SQLite economy with persistent balances and kit cooldowns.

  • Commands:

    • /balance, /bal

    • /pay <player> <amount>

    • /eco give|take|set|reset

    • /shop

    • /kit

  • Secure shop GUI with categories, quantity purchasing, server-side prices, balance checks, and exploit protection.

  • Diamonds SMP kit with enchanted armor, tools, weapons, potions, food, blocks, and exactly 64 Breeze Rods.

  • Default config.yml generated automatically.

  • Admin permission: diamondssmp.eco.admin.

  • SQLite and XSeries dependencies are bundled into the final JAR.

Build:

Shell
mvn clean package

Output:

Plain Text
target/diamonds-smp-1.0.0.jar

Installation:

  1. Build the project with Maven.

  2. Copy target/diamonds-smp-1.0.0.jar into the Paper server’s plugins folder.

  3. Start or restart the server.

  4. The plugin automatically creates its configuration, data folder, SQLite database, tables, and default player balances.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
21 1,288
src/main/java/com/diamondssmp/DiamondsSMP.java
package com.diamondssmp;

import com.diamondssmp.command.BalanceCommand;
import com.diamondssmp.command.EcoCommand;
import com.diamondssmp.command.KitCommand;
import com.diamondssmp.command.PayCommand;
import com.diamondssmp.command.ShopCommand;
import com.diamondssmp.database.DatabaseManager;
import com.diamondssmp.economy.EconomyManager;
import com.diamondssmp.gui.GuiListener;
import com.diamondssmp.kit.KitManager;
import com.diamondssmp.shop.ShopGUI;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class DiamondsSMP extends JavaPlugin {
    private DatabaseManager database;
    private EconomyManager economy;
    private ShopGUI shopGUI;
    private KitManager kitManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        database = new DatabaseManager(this);
        if (!database.initialize()) {
            getLogger().severe("Could not initialize the SQLite database. Disabling plugin.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        economy = new EconomyManager(this, database);
        shopGUI = new ShopGUI(this, economy);
        kitManager = new KitManager(this, database);

        Bukkit.getPluginManager().registerEvents(new GuiListener(shopGUI, kitManager), this);

        getCommand("balance").setExecutor(new BalanceCommand(economy));
        getCommand("pay").setExecutor(new PayCommand(economy));
        getCommand("pay").setTabCompleter(new PayCommand(economy));
        getCommand("eco").setExecutor(new EcoCommand(economy));
        getCommand("eco").setTabCompleter(new EcoCommand(economy));
        getCommand("shop").setExecutor(new ShopCommand(shopGUI));
        getCommand("kit").setExecutor(new KitCommand(kitManager));

        getLogger().info("DiamondsSMP enabled with SQLite persistence.");
    }

    @Override
    public void onDisable() {
        if (database != null) {
            database.close();
        }
    }
}