andrexdop
📎 1 file 25,623 chars
📄
pasted-code-1787389299978.txt
txt 1379 lines
▶
Act as an expert Minecraft Paper plugin developer, Java developer, database engineer, economy designer, INVENTORY GUI developer, security engineer, and Minecraft server administrator.

I want you to CREATE THE ENTIRE PLUGIN for me. Do NOT just explain how to make it. Do NOT give me pseudocode. Do NOT leave TODOs for major features. Do NOT give me partial snippets and tell me to finish them. I want the complete source code for a production-ready Minecraft economy plugin that can be compiled into a .jar and placed directly into my Paper server's plugins folder.

PLUGIN NAME:
ServerEconomy

MAIN PACKAGE:
me.tanvir.servereconomy

VERSION:
1.0.0

TARGET:
Paper 26.2

JAVA:
Java 25

IMPORTANT:
This server is running Paper 26.2, GeyserMC, Floodgate, and LuckPerms. The plugin must work on Paper 26.2 specifically. Do not blindly use old 1.20/1.21 APIs. Do not invent APIs. Use the correct modern Paper API for 26.2. Avoid deprecated APIs where possible. Do not use NMS unless absolutely necessary.

The plugin must work for both Java and Bedrock players through Geyser/Floodgate as much as possible.

MAIN GOAL:
Create a complete economy system that feels somewhat inspired by Donut SMP but has its own identity.

The economy should be:
- Easy for beginners to understand
- Friendly to casual players
- Rewarding for smart players
- Rewarding for efficient players
- Challenging without requiring players to grind all day
- Resistant to inflation
- Resistant to duplication
- Resistant to AFK abuse
- Resistant to transaction exploits
- Compatible with Java and Bedrock
- Easy to configure
- Easy to expand later
- Stable after restarts and crashes

A stupid/inexperienced player should still be able to make money slowly.
A smart player should be able to make much more money by understanding farming, mining, combat, exploration, trading, contracts, market bonuses, and player-to-player activity.
Do not design the economy so one automatic farm is always the best way to make money.

I WANT THE PLUGIN TO HAVE THESE CORE FEATURES:

1. Individual player balances
2. Balance checking
3. Player-to-player payments
4. Server shop
5. INVENTORY GUI shop
6. Buying
7. Selling
8. Sell hand
9. Sell all
10. Prices
11. Balance leaderboard
12. Transaction history
13. Admin economy controls
14. Kits
15. Shulker-box kits
16. Contracts
17. Daily hot market
18. Soft selling limits
19. Bounties
20. Economy taxes
21. Money sinks
22. SQLite database
23. Automatic database backups
24. Transaction safety
25. Anti-duplication protections
26. Crash/restart safety
27. Permission support
28. PlaceholderAPI support if installed
29. Vault/VaultUnlocked economy integration if possible
30. Geyser/Floodgate compatibility
31. Clean configuration files
32. Extensive logging
33. Admin statistics
34. Reloading configuration without using Bukkit /reload
35. Tab completion
36. Good error handling

COMMANDS FOR NORMAL PLAYERS:

/bal
/balance
/pay  
/shop
/shop buy  
/shop sell  
/sellhand
/sellall
/price 
/baltop
/contracts
/bounty

COMMANDS FOR ADMINS:

/eco give  
/eco take  
/eco set  
/eco inspect 
/eco history 
/eco reload
/eco audit

Create useful aliases where appropriate.

ALL COMMANDS MUST HAVE:
- Proper argument validation
- Tab completion
- Permissions
- Good error messages
- Amount validation
- Protection against negative amounts
- Protection against impossible amounts
- Protection against overflow
- Protection against NaN/infinite values
- Good handling of offline players where appropriate
- Bedrock-friendly usage

PERMISSIONS:

servereconomy.use
servereconomy.balance
servereconomy.pay
servereconomy.shop
servereconomy.sell
servereconomy.baltop
servereconomy.contracts
servereconomy.bounty

Admin:
servereconomy.admin
servereconomy.eco.give
servereconomy.eco.take
servereconomy.eco.set
servereconomy.eco.inspect
servereconomy.eco.history
servereconomy.eco.reload
servereconomy.eco.audit

The plugin must work properly with LuckPerms.

ECONOMY:

Currency name:
Dollar

Currency symbol:
$

Starting balance:
250

Use safe fixed-precision money handling. Prefer integer cents or another safe exact representation instead of floating point calculations for actual balances.

Prevent:
- Negative balances unless explicitly allowed by admin
- Negative payments
- Negative purchases
- Negative sell quantities
- Huge overflow amounts
- NaN
- Infinity
- Duplicate transactions

DATABASE:

Use SQLite by default.

Database location:
plugins/ServerEconomy/economy.db

Database must contain at least:
players
transactions
sell_limits
contracts
kit_purchases
bounties

Players table should contain:
UUID
name
balance
created_at
updated_at

Transactions table should contain:
transaction_id
player_uuid
player_name
transaction_type
amount
balance_before
balance_after
description
timestamp

Player-to-player transactions should also record sender UUID and receiver UUID.

Use prepared statements.
Never concatenate user input directly into SQL.
Use indexes where appropriate.
Avoid blocking the main server thread with database operations.
Use asynchronous database work when safe.
Anything that changes Bukkit state must happen on the main thread when required.

TRANSACTION SYSTEM:

EVERY economy-changing action MUST create a transaction record.

Transaction types should include:
SELL
BUY
PAY
ADMIN_GIVE
ADMIN_TAKE
ADMIN_SET
CONTRACT_REWARD
BOUNTY_REWARD
AUCTION_SALE
TAX
KIT_PURCHASE

Create unique transaction IDs such as:
TX-8F71D29A

Balance changes must always go through one central economy service.

Do not randomly modify balances directly in commands.

Create something like:
EconomyService
TransactionService
EconomyRepository

The system must prevent:
- Double transactions
- Duplicate kit purchases
- Transaction replay
- Double clicking
- Concurrent transaction issues
- Restart duplication
- Crash duplication

If the server crashes during a transaction, money and rewards must not be duplicated or permanently lost.

PLAYER BALANCE:

/bal and /balance should show something like:

Balance: $12,450

/pay Steve 500 should say:

You paid Steve $500.
Your new balance: $11,950.

Do not allow paying yourself.

Do not allow payments larger than the sender's balance.

Allow offline players to receive payment if configured.

Balance belongs to UUID, not player name.

Player names are display values only.

STARTER MONEY:

On first join only, give the player $250.

Never give it twice.

Send something like:

Welcome!
You received $250.
Use /shop to view the market.
Use /sellall to sell resources.
Use /contracts to see today's contracts.

SHOP:

Create a complete INVENTORY GUI shop with categories:

Blocks
Farming
Mob Drops
Mining
Nether
Special
Food
Kits

The INVENTORY GUI should be clean and beginner-friendly.

It must support:
- Categories
- Pagination
- Buy buttons
- Sell buttons
- Quantity selection
- Confirmation
- Cancel
- Current balance
- Current price
- Quantity
- Total cost
- Total revenue
- Navigation buttons

It must work for Java players and remain usable for Bedrock players through Geyser.

Do not make core economy functionality depend entirely on Java-client-specific behavior.

BUY CONFIRMATION:

Expensive purchases should require confirmation.

At minimum, purchases above $5,000 require confirmation.

$50,000+ purchases should have extremely clear confirmation.

Example:

PURCHASE CONFIRMATION
Item: Ultimate Kit
Price: $50,000
Your balance: $73,421
Balance after purchase: $23,421
[CONFIRM]
[CANCEL]

Do not charge the player until the purchase is fully confirmed and can be delivered.

INVENTORY SAFETY:

Before giving any item or kit:
- Check inventory space
- Do not charge if inventory cannot receive the reward
- Do not silently drop valuable purchases on the ground

If there is not enough space:

You need at least 1 free inventory slot.
Your money has NOT been charged.

ITEM SELLING:

Only explicitly configured items may be sold.

Do not allow players to sell arbitrary items.

/sellhand:
Sells the item in the player's main hand.

/sellall:
Sells all configured sellable items in the player's inventory.

After selling, show:
- Items sold
- Quantity
- Total earned
- New balance

Example:

Sold:
512 Cobblestone

Earned:
$512

New balance:
$4,712

For large sales, support configurable confirmation.

DEFAULT SELL PRICES:

Cobblestone = $1
Stick = $1
Sugar Cane = $2
Wool = $8
Leather = $15
Pumpkin = $8
Melon Slice = $2
Cactus = $3
Coal = $8
Iron Ingot = $30
Redstone Dust = $5
String = $6
Gunpowder = $15
Slimeball = $30
Ender Pearl = $50
Blaze Rod = $75
Nether Wart = $20
Obsidian = $40
Magma Cream = $100
Ghast Tear = $250
Shulker Shell = $1000

ALL PRICES MUST BE CONFIGURABLE IN YAML.
Do not hard-code these prices.

DEFAULT ITEMS THAT MUST NOT BE SELLABLE:

Diamond
Diamond Block
Netherite Scrap
Netherite Ingot
Netherite Block
Elytra
Totem of Undying
Shulker Box
Enchanted Books
Spawner
Rare Smithing Templates
Rare Armor Trims

These should only become sellable if the server administrator explicitly enables them.

BUY PRICES:

Golden Apple = $25
Golden Carrot = $10
Totem of Undying = $1,000
Diamond Kit = $2,000
Enchanted Diamond Kit = $5,000
Netherite Kit = $10,000
Ultimate Kit = $50,000
God Kit = $100,000

All configurable.

KITS:

All kits MUST be delivered inside a newly generated shulker box.

Do not use one physical pre-made shulker box.
Generate it dynamically.

Every kit shulker should have:
- Custom color
- Custom name
- Custom lore
- Purchase metadata
- Unique transaction ID

Example:

DIAMOND KIT
Purchased from Server Shop
Transaction: TX-8F71D29A

Create a reusable ShulkerBuilder class that can:
- Create shulker boxes
- Set color
- Set name
- Set lore
- Add contents
- Add metadata
- Add transaction ID
- Return ItemStack

DIAMOND KIT:
Price $2,000

Contents:
1 Diamond Helmet
1 Diamond Chestplate
1 Diamond Leggings
1 Diamond Boots
1 Diamond Sword
1 Diamond Pickaxe
1 Diamond Axe
1 Diamond Shovel
1 Shield
32 Cooked Beef
16 Golden Carrots

Armor:
Protection II
Unbreaking II

Sword:
Sharpness II
Unbreaking II

Pickaxe:
Efficiency II
Unbreaking II

Axe:
Efficiency II
Unbreaking II

Shovel:
Efficiency II
Unbreaking II

ENCHANTED DIAMOND KIT:
Price $5,000

Armor:
Protection IV
Unbreaking III
Mending

Helmet:
Respiration III
Aqua Affinity

Boots:
Feather Falling IV
Depth Strider III

Leggings:
Swift Sneak III

Sword:
Sharpness V
Looting III
Fire Aspect II
Unbreaking III
Mending

Pickaxe:
Efficiency V
Fortune III
Unbreaking III
Mending

Axe:
Efficiency V
Sharpness V
Unbreaking III
Mending

Shovel:
Efficiency V
Unbreaking III
Mending

Bow:
Power V
Unbreaking III
Flame
Infinity

Supplies:
64 Cooked Beef
32 Golden Carrots
8 Golden Apples

NETHERITE KIT:
Price $10,000

Full Netherite Armor
Netherite Sword
Netherite Pickaxe
Netherite Axe
Netherite Shovel

Armor:
Protection IV
Unbreaking III
Mending

Weapons/tools should be strong but not automatically completely maxed in every possible enchantment.

ULTIMATE KIT:
Price $50,000

Full Netherite Armor
Netherite Sword
Netherite Pickaxe
Netherite Axe
Netherite Shovel
Netherite Hoe
Elytra
16 Totems of Undying
32 Golden Apples
64 Golden Carrots
Firework Rockets

Require strong confirmation before purchase.

GOD KIT:
Price $100,000

Full high-tier Netherite armor
Netherite Sword
Netherite Pickaxe
Netherite Axe
Netherite Shovel
Netherite Hoe
Bow
Elytra
32 Totems
32 Golden Apples
64 Golden Carrots
Firework Rockets
Ender Chest

God Kit cooldown:
7 days

The God Kit cooldown must survive server restarts.
Store it in the database.

KIT TRANSACTION FLOW:

When purchasing a kit:

Lock transaction
Check balance
Check cooldown
Check inventory space
Generate kit
Remove money
Deliver kit
Write transaction
Unlock transaction

If any step fails:
Do not remove money
Do not deliver duplicate rewards

Protect against:
- Double click exploits
- Shift click
- Number key exploits
- Inventory drag exploits
- INVENTORY GUI spoofing
- Duplicate transactions
- Disconnect during purchase
- Server crash
- Restart
- Item duplication

DAILY CONTRACTS:

Create:

/contracts

Each day generate several contracts.

Examples:

Deliver 1,000 Cobblestone
Reward $1,250

Kill 75 Blazes
Reward $2,500

Deliver 256 Leather
Reward $1,000

Travel 3,000 blocks from spawn
Reward $1,500

Contracts must be configurable.

Store progress.
Prevent duplicate claims.
Prevent replay after restart.

DAILY HOT MARKET:

Create a simple daily market bonus.

DO NOT constantly replace base prices.

Instead, keep the base price and apply a temporary multiplier.

Example:

Leather x1.5
Blaze Rod x2.0
Obsidian x1.5

/price blaze_rod should show:

Item: Blaze Rod
Base: $75
Today's Bonus: x2
Current Sell Price: $150

Make the system configurable.

SOFT SELL LIMITS:

Use soft limits rather than frustrating hard bans.

Example:

First 512 Sugar Cane:
100% price

Next 1024:
75%

Next 2048:
50%

After that:
25%

These limits reset daily.

Not every item needs a limit.

The system must be configurable per item.

PROGRESSION:

Stage 1: New Player
Balance $0-$2,000
Income roughly $300-$800/hour
Methods:
Mining
Basic farming
Cobblestone
Wood
Wool
Basic mob drops
Goal:
Diamond Kit

Stage 2: Developing
Balance $2,000-$10,000
Income $1,000-$3,000/hour
Methods:
Mob farms
Better farms
Trading
Nether
Contracts
Goal:
Enchanted Diamond / Netherite

Stage 3: Established
Balance $10,000-$50,000
Income $3,000-$8,000/hour
Methods:
Nether hunting
Player trading
Auction House
Advanced farms
Exploration
Contracts
Market bonuses
Goal:
Ultimate Kit

Stage 4: Endgame
Balance $50,000+
Methods:
High-value trading
PvP
Bounties
Rare resources
Market activity
Advanced contracts
Events
Goal:
God Kit
Player businesses
Market dominance

MONEY SINKS:

Implement configurable money sinks.

Auction sale tax:
5%

Teleport:
$50

Player teleport:
$10

Additional homes:
Home #1 free
Home #2 $500
Home #3 $1,500
Home #4 $5,000

Optional repair fees.

All configurable.

BOUNTIES:

Create:

/bounty
/bounty  

Money used to create a bounty must come from the creator's existing balance.

When the target is killed by another valid player, the bounty is paid to the killer.

Do not create money from nowhere for bounties.

Prevent:
- Self bounty
- Self kill
- Fake kills
- Repeated abuse
- Instant reconnect exploitation

ECONOMY API:

Expose a clean service/API containing methods similar to:

getBalance(UUID uuid)
hasBalance(UUID uuid, amount)
deposit(UUID uuid, amount, reason)
withdraw(UUID uuid, amount, reason)
transfer(UUID from, UUID to, amount, reason)

All balance modifications must go through the same service.

VAULT:

If Vault or VaultUnlocked is installed, register as an economy provider if appropriate.

Do not make the plugin depend on another economy plugin to function.

This plugin should be capable of being the primary economy provider.

If Vault is not installed, ServerEconomy should still work normally.

PLAYER DATA:

Load player balances by UUID.

Never use username as the primary identifier.

Player name should only be display information.

Support username changes correctly.

On join:
Load balance and required player data.

On quit:
Save any needed state.

Do not create duplicate accounts.

OFFLINE PLAYERS:

Balance is tied to UUID.

Allow offline payments if configured.

PlaceholderAPI support:

If PlaceholderAPI is installed, register:
%servereconomy_balance%
%servereconomy_balance_formatted%
%servereconomy_rank%

PlaceholderAPI should be optional.

BALTOP:

/baltop

Show top balances.

Use caching or efficient queries.
Do not spam the database from the main thread.

Example:

1. Steve $125,421
2. Alex $98,210
3. Tanvir $73,421

Support pagination.

ADMIN AUDIT:

/eco audit

Show:
- Total money in circulation
- Average balance
- Median balance if practical
- Highest balance
- Total money created today
- Total money destroyed today
- Total transactions today
- Most sold items
- Most purchased items

This is important for balancing the server.

CONFIG FILES:

Generate all of these:

config.yml
shop.yml
kits.yml
contracts.yml
market.yml
messages.yml

Make them beginner-friendly.

Example config:

currency:
  symbol: "$"
  name: "Dollar"
  starting-balance: 250

database:
  type: "SQLITE"
  file: "economy.db"

selling:
  large-sale-confirmation-threshold: 5000

tax:
  auction-sale: 0.05

limits:
  enabled: true

market:
  enabled: true

contracts:
  enabled: true

backups:
  enabled: true
  interval-hours: 6
  keep: 20

Use comments in YAML to explain values.

MESSAGES:

Make all user-facing text configurable.

Example:

prefix: "&6&lEconomy &8» &r"
no-permission: "&cYou don't have permission."
not-enough-money: "&cYou don't have enough money."
invalid-amount: "&cInvalid amount."
transaction-success: "&aTransaction completed."
inventory-full: "&cYou need more inventory space."

Do not hard-code major messages in Java.

RELOAD:

Implement /eco reload

It should safely reload:
config.yml
shop.yml
kits.yml
contracts.yml
market.yml
messages.yml

Do NOT rely on Bukkit's global /reload.

Do not reload in a way that duplicates listeners or breaks GUIs.

ERROR HANDLING:

If configuration is invalid:
- Log clear errors
- Identify the exact file
- Identify the exact setting
- Continue loading valid sections where possible

Example:

[ServerEconomy] ERROR: Invalid material in kits.yml: DIAMOND_SUPER_SWORD

If a database problem occurs:
- Do not silently lose money
- Do not fake successful transactions
- Log the problem clearly
- Fail safely

LOGGING:

Use clean INFO/WARNING/SEVERE levels.

Do not spam console every time someone sells one cobblestone.

Database should contain transaction history.

Admin actions can optionally be logged to console.

SECURITY:

The entire system must protect against:
- Negative values
- Overflow
- Duplicate transactions
- Double-click exploits
- Shift-click
- Number-key exploits
- Dragging exploits
- INVENTORY GUI spoofing
- Item duplication
- Transaction replay
- Concurrent transactions
- Disconnects
- Restart edge cases
- Client-side fake input
- Invalid item data

Never trust client input.

INVENTORY GUI SECURITY:

Do not identify buttons using only display names or slots.

Track INVENTORY GUI state securely on the server.

Do not trust client-provided item names or lore.

Prevent users from moving INVENTORY GUI items into their own inventory.

Prevent inventory desync as much as reasonably possible.

THREADING:

Database work should be asynchronous where appropriate.

Do not access Bukkit/Paper objects incorrectly from asynchronous threads.

Do not do large database operations every tick.

Do not scan every player's entire inventory every tick.

Use caching where appropriate.

PERFORMANCE:

The plugin must be suitable for a real multiplayer server.

Avoid:
- Constant SQL calls
- Main-thread database blocking
- Infinite loops
- Memory leaks
- Unbounded caches
- Re-parsing YAML constantly
- Expensive tasks every tick

PAPER API:

Use modern Paper 26.2 APIs.

Prefer Adventure components where appropriate.

Avoid outdated APIs.

Do not invent classes that do not exist.

Do not use deprecated APIs unless there is no practical modern alternative.

Do not use NMS unless absolutely necessary.

GEYSER/FLOODGATE:

The plugin must not require Geyser to load.

If Geyser/Floodgate exists, the economy should still work.

Commands should be usable by Bedrock users.

GUIs should be usable by Bedrock users as much as possible.

Do not require special Java-only INVENTORY GUI interaction for core features.

PROJECT STRUCTURE:

Use a clean architecture similar to:

ServerEconomy/
build.gradle.kts
settings.gradle.kts
gradle.properties
README.md

src/main/java/me/tanvir/servereconomy/

ServerEconomy.java

economy/
EconomyService.java
EconomyRepository.java
TransactionService.java

database/
DatabaseManager.java
MigrationManager.java
BackupManager.java

commands/
BalanceCommand.java
PayCommand.java
SellCommand.java
ShopCommand.java
PriceCommand.java
BaltopCommand.java
ContractsCommand.java
BountyCommand.java
EconomyAdminCommand.java

INVENTORY GUI/
ShopGUI.java
ShopCategoryGUI.java
PurchaseConfirmationGUI.java
QuantityGUI.java

kits/
KitService.java
KitDefinition.java
ShulkerBuilder.java

contracts/
ContractService.java
Contract.java

market/
MarketService.java
MarketBonus.java

limits/
SellLimitService.java

bounty/
BountyService.java

hooks/
VaultHook.java
PlaceholderAPIHook.java
FloodgateHook.java

listeners/
PlayerJoinListener.java
PlayerQuitListener.java
InventoryListener.java
EntityDeathListener.java

util/
MessageUtil.java
MoneyUtil.java
ItemUtil.java
TimeUtil.java

resources:
plugin.yml
config.yml
shop.yml
kits.yml
contracts.yml
market.yml
messages.yml

MAIN CLASS:

The main class should only primarily handle:
- Initialization
- Dependency detection
- Loading services
- Registering commands
- Registering listeners
- Registering hooks
- Shutdown

Do not put the entire plugin inside one giant Java class.

BUILD SYSTEM:

Use Gradle Kotlin DSL.

Use the correct Paper 26.2 development bundle/tooling.

Use Java 25.

The project should build using:

gradlew.bat build

on Windows.

If dependencies like SQLite JDBC are needed, safely shade them or use the appropriate dependency strategy.

PLUGIN METADATA:

Create the correct plugin.yml or modern Paper metadata system for the exact Paper API you choose.

Register all commands and permissions.

README:

Create a complete README including:
- Requirements
- Installation
- Commands
- Permissions
- Configuration
- Database
- Backups
- Kits
- Shop
- Contracts
- Market
- Bounties
- Troubleshooting
- Updating
- Restoring backups
- Common mistakes
- How to configure prices

VERY IMPORTANT:

Do not tell me "this should work" if you have not checked it.

Do not give me fake code.

Do not give me incomplete code.

Do not leave TODOs for major systems.

Do not give classes that don't connect correctly.

Do not invent methods or APIs.

If you have access to a compiler/build environment:
1. Create the complete project
2. Compile it
3. Fix compilation errors
4. Run tests if possible
5. Only then provide the finished result

If compilation fails, fix the errors instead of giving me broken code.

TEST ALL OF THESE:

First join
Starting balance
Balance
Pay
Invalid payment
Negative payment
Huge payment
Selling
Sellhand
Sellall
Forbidden selling
Buying
Insufficient balance
Full inventory
Kit purchase
Kit cooldown
Kit duplicate exploit
INVENTORY GUI clicking
Shift click
Number key
Drag exploit
Disconnect during purchase
Server restart
Database restart
Database failure
Admin commands
Permissions
Bedrock players
Java players
Contracts
Contract rewards
Duplicate contract claims
Market bonuses
Soft sell limits
Bounties
Bounty abuse
Transactions
Transaction history
Backups
Leaderboard
PlaceholderAPI
Vault integration

DEFAULT ECONOMY:

Starting balance: $250

SELL:

Cobblestone $1
Stick $1
Sugar Cane $2
Wool $8
Leather $15
Pumpkin $8
Melon Slice $2
Cactus $3
Coal $8
Iron Ingot $30
Redstone Dust $5
String $6
Gunpowder $15
Slimeball $30
Ender Pearl $50
Blaze Rod $75
Nether Wart $20
Obsidian $40
Magma Cream $100
Ghast Tear $250
Shulker Shell $1,000

BUY:

Golden Apple $25
Golden Carrot $10
Totem of Undying $1,000
Diamond Kit $2,000
Enchanted Diamond Kit $5,000
Netherite Kit $10,000
Ultimate Kit $50,000
God Kit $100,000

Auction tax: 5%
God Kit cooldown: 7 days
Teleport fee: $50
Player teleport fee: $10

Homes:
Home #1 free
Home #2 $500
Home #3 $1,500
Home #4 $5,000

FINAL REQUIREMENT:

I do not want a tutorial.

I want the actual complete plugin.

Generate the entire working project with every Java file, every configuration file, build files, plugin metadata, database implementation, INVENTORY GUI system, shop system, kit system, contracts, market bonuses, bounties, anti-abuse systems, transaction system, backup system, commands, permissions, hooks, and documentation.

If you can create files directly, create the complete project.

If you can compile it, compile it.

If compilation finds errors, fix them.

Do not stop until the plugin is complete and internally consistent.

The final result should be something I can build into a .jar and place in my Paper 26.2 server.

BUILD THE WHOLE PLUGIN.
Kodari AI
KodariAug 22 at 9:06 am 5
  1. Create the Gradle project, metadata, and configuration files.

  2. Implement the SQLite-backed economy, transaction, shop, kit, contract, market, limit, and bounty services.

  3. Add commands, secure inventory GUIs, listeners, optional hooks, backups, and documentation.

Created the initial ServerEconomy project structure, including:

  • Gradle Kotlin build files targeting Java 25

  • Paper plugin metadata

  • SQLite database and backup management

  • Exact cent-based economy storage

  • Centralized deposits, withdrawals, and transfers

  • Transaction history

  • Configurable shop and prices

  • Shop GUI with click/drag protection

  • Sell hand and sell-all commands

  • Configurable kits delivered in generated shulker boxes

  • Market multipliers and sell limits

  • Bounty creation and payout handling

  • Balance, payment, shop, pricing, leaderboard, admin, and bounty commands

  • PlaceholderAPI support

  • Vault economy provider

  • Player UUID-based accounts

  • Configurable YAML files

  • README documentation

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle.kts
gradle.properties
README.md
settings.gradle.kts
Code
43 1,280
src/main/java/me/tanvir/servereconomy/ServerEconomy.java
package me.tanvir.servereconomy;

import me.tanvir.servereconomy.bounty.BountyService;
import me.tanvir.servereconomy.commands.*;
import me.tanvir.servereconomy.database.BackupManager;
import me.tanvir.servereconomy.database.DatabaseManager;
import me.tanvir.servereconomy.economy.*;
import me.tanvir.servereconomy.gui.GuiManager;
import me.tanvir.servereconomy.hooks.PlaceholderHook;
import me.tanvir.servereconomy.hooks.VaultHook;
import me.tanvir.servereconomy.limits.SellLimitService;
import me.tanvir.servereconomy.listeners.EntityDeathListener;
import me.tanvir.servereconomy.listeners.InventoryListener;
import me.tanvir.servereconomy.listeners.PlayerListener;
import me.tanvir.servereconomy.market.MarketService;
import me.tanvir.servereconomy.shop.ShopService;
import me.tanvir.servereconomy.kits.KitService;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;

import java.sql.SQLException;

public final class ServerEconomy extends JavaPlugin {
    private ConfigManager configs;
    private DatabaseManager database;
    private EconomyRepository repository;
    private EconomyService economy;
    private TransactionService transactions;
    private ShopService shop;
    private KitService kits;
    private MarketService market;
    private SellLimitService sellLimits;
    private BountyService bounties;
    private GuiManager gui;

    @Override public void onEnable() {
        configs = new ConfigManager(this); configs.load();
        database = new DatabaseManager(this);
        try { database.open(); } catch (SQLException exception) { getLogger().severe("Database startup failed: " + exception.getMessage()); getServer().getPluginManager().disablePlugin(this); return; }
        repository = new EconomyRepository(database); transactions = new TransactionService(database); economy = new EconomyService(this, repository, transactions); shop = new ShopService(this); kits = new KitService(this); market = new MarketService(this); sellLimits = new SellLimitService(this, database); bounties = new BountyService(this); gui = new GuiManager();
        registerCommands();
        Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this); Bukkit.getPluginManager().registerEvents(new InventoryListener(gui), this); Bukkit.getPluginManager().registerEvents(new EntityDeathListener(bounties), this);
        if (getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) new PlaceholderHook(this).register();
        if (getServer().getPluginManager().isPluginEnabled("Vault")) Bukkit.getServicesManager().register(Economy.class, new VaultHook(this), this, ServicePriority.Highest);
        if (getConfig().getBoolean("backups.enabled", true)) { long ticks = Math.max(1, getConfig().getLong("backups.interval-hours", 6) * 60L * 60L * 20L); Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> new BackupManager(this).backup(), ticks, ticks); }
    }

    private void registerCommands() {
        register("bal", new BalanceCommand(this), null); register("pay", new PayCommand(this), new PayCommand(this)); register("shop", new ShopCommand(this), new ShopCommand(this)); register("sellhand", new SellCommand(this), null); register("sellall", new SellCommand(this), null); register("price", new PriceCommand(this), null); register("baltop", new BaltopCommand(this), null); register("contracts", new ContractsCommand(this), null); register("bounty", new BountyCommand(this), null); register("eco", new EconomyAdminCommand(this), new EconomyAdminCommand(this));
    }
    private void register(String name, org.bukkit.command.CommandExecutor executor, org.bukkit.command.TabCompleter completer) { PluginCommand command = getCommand(name); if (command != null) { command.setExecutor(executor); if (completer != null) command.setTabCompleter(completer); } }
    public void reloadPlugin() { configs.reload(); }
    public void ensurePlayer(OfflinePlayer player) { ensurePlayer(player.getUniqueId(), player.getName() == null ? player.getUniqueId().toString() : player.getName()); }
    public void ensurePlayer(java.util.UUID uuid, String name) { try { long starting = economy.parse(getConfig().getString("currency.starting-balance", "250.00")); repository.ensure(uuid, name, Math.max(0, starting)); } catch (SQLException exception) { getLogger().severe("Could not create player account: " + exception.getMessage()); } }
    public String money(long cents) { return me.tanvir.servereconomy.util.MoneyUtil.format(cents, getConfig().getString("currency.symbol", "$")); }
    @Override public void onDisable() { if (database != null) database.close(); }
    public ConfigManager configs() { return configs; }
    public org.bukkit.configuration.file.FileConfiguration messages() { return configs.get("messages"); }
    public DatabaseManager database() { return database; }
    public EconomyRepository repository() { return repository; }
    public EconomyService economy() { return economy; }
    public ShopService shop() { return shop; }
    public KitService kits() { return kits; }
    public MarketService market() { return market; }
    public SellLimitService sellLimits() { return sellLimits; }
    public BountyService bounties() { return bounties; }
    public GuiManager gui() { return gui; }
}