Create a production-ready Minecraft Paper plugin for my SMP called “BDT Economy”. The entire server economy must use Bangladeshi Taka (৳ / BDT). Do NOT use dollars, coins, Chaos Tokens, Vault money, or any other currency.
IMPORTANT:
Build this as ONE complete standalone plugin. The plugin must be stable, persistent, secure, and production-ready. Do not create a prototype or partially working system. Before finishing, thoroughly test every feature and fix all bugs, duplication exploits, item-loss bugs, INVENTORY GUI bugs, reload bugs, restart bugs, race conditions, permission bypasses, and economy exploits.
TARGET:
- Minecraft Paper 1.21.x
- Java 21+
- SQLite by default
- UUID-based player accounts
- Persistent data must survive server restart/reload
- No dependency on Vault
- No dependency on another economy plugin
==================================================
- CURRENCY — BANGLADESHI TAKA
==================================================
The only currency is Bangladeshi Taka (৳).
Supported physical denominations:
৳1 ৳5 ৳10 ৳20 ৳50 ৳100 ৳500 ৳1000 ৳5000 ৳10000
All denominations must be configurable.
Every physical Taka note must be a custom Minecraft item using a resource pack.
Each note must contain secure PersistentDataContainer data identifying:
- Currency type
- Denomination
- Unique note ID
- Plugin version
Never identify legitimate money only by display name or lore.
Players must not be able to create legitimate money simply by renaming an item in an anvil.
==================================================
- BANK ACCOUNT
Every player has a bank account stored by UUID.
Commands:
/balance /money
Display:
Wallet: ৳X Bank: ৳Y Total: ৳Z
The bank balance must be stored in SQLite.
Never use player names as the primary database key.
If a player changes their username, their money must remain.
==================================================
- PLAYER PAYMENTS
Command:
/pay <player> <amount>
Example:
/pay Redwan 500
Requirements:
- Cannot pay yourself.
- Amount must be positive.
- Cannot use negative values.
- Cannot use decimals unless decimals are explicitly enabled.
- Sender must have sufficient balance.
- Receiver must exist.
- Transaction must be atomic.
- Never remove money from sender unless receiver successfully receives it.
- Prevent double payment from repeated clicks/commands.
- Give clear success/failure messages.
==================================================
- ADMIN MONEY COMMANDS
Admin commands:
/economy give <player> <amount> /economy take <player> <amount> /economy set <player> <amount> /economy balance <player> /economy givephysical <player> <amount> /economy reload
Permissions:
bdteconomy.admin
Only authorized admins can use administrative economy commands.
Prevent integer overflow and invalid amounts.
==================================================
- ATM SYSTEM
Create a physical ATM system.
Admin command:
/economy giveatm
This gives an ATM placement item.
The ATM must be identifiable using PersistentDataContainer.
When an authorized player places the ATM, save its exact location in the database.
When a player right-clicks the ATM, open the ATM INVENTORY GUI.
ATM INVENTORY GUI must contain:
- Bank Balance
- Deposit
- Withdraw
- Close
Optional:
- Quick Withdraw
- Quick Deposit
- Transaction History
ATM INVENTORY GUI must be configurable.
==================================================
- ATM WITHDRAW
When player chooses Withdraw:
Show selectable amounts:
৳100 ৳500 ৳1000 ৳5000 ৳10000
Also provide a custom amount option.
Example:
Bank balance: ৳25,000
Player withdraws: ৳5,000
Result:
Bank: ৳20,000
Physical money: ৳5,000
The transaction MUST be atomic.
If the player's inventory is full, do NOT remove the money from the bank.
Instead show:
“Your inventory is full.”
If only part of the required physical money can fit, the transaction must fail completely unless the system safely supports partial transactions.
Never allow money duplication.
==================================================
- ATM DEPOSIT
Player can deposit legitimate physical Taka notes.
Example:
Inventory: ৳100 × 3 ৳500 × 2
Total: ৳1,300
Deposit:
Bank balance +৳1,300
Physical notes are removed.
Only genuine plugin-generated Taka items can be deposited.
Fake renamed paper/items must be rejected.
Handle stacked notes safely.
Never lose money if the transaction fails.
==================================================
- ATM BREAKING / SECURITY
Normal players must NOT be able to break placed ATMs.
Only authorized admins can remove them.
If an authorized admin breaks an ATM:
- Remove its database record.
- Give the ATM placement item back.
- Do not duplicate the ATM.
- Do not lose the ATM.
Prevent piston movement, hopper exploitation, container exploits, and other ways of bypassing protection.
If necessary, cancel unsupported block interactions/events.
==================================================
- VENDING MACHINE
Create a physical Vending Machine.
Admin command:
/economy givevending
The item can be placed in the world.
Save the machine location and a unique machine ID.
Each machine must have its own inventory/shop configuration.
Normal player:
Right-click Vending Machine → Open Shop INVENTORY GUI
==================================================
- SHOPKEEPERS-STYLE VENDING MACHINE EDITING
This is extremely important.
Make the Vending Machine editing experience similar to Shopkeepers-style INVENTORY GUI management.
Admins must NOT need commands every time they want to edit a vending machine.
When an authorized admin right-clicks a vending machine:
Open the normal Vending Machine INVENTORY GUI.
Add an:
⚙ EDIT SHOP
button.
Normal players must NEVER see the Edit Shop button.
Permission:
bdteconomy.vending.edit
When admin clicks:
⚙ EDIT SHOP
Open:
Vending Machine Editor INVENTORY GUI
==================================================
- VENDING MACHINE EDITOR
The editor must allow drag-and-drop configuration.
Admin can:
- Add item
- Remove item
- Change item
- Set buy price
- Set sell price if selling is enabled
- Set stock
- Add stock
- Remove stock
- Set unlimited stock
- Change shop name
- Change item display name
- Enable/disable item
- Save changes
- Cancel changes
Example:
Diamond
Buy Price: ৳500
Stock: 10
Player sees:
Diamond Price: ৳500 Stock: 10
[ BUY ]
The editor must support multiple products per machine.
==================================================
- VENDING MACHINE TRANSACTIONS
When player buys an item:
- Verify machine exists.
- Verify product exists.
- Verify product is enabled.
- Verify stock.
- Verify price.
- Verify player has enough Taka.
- Verify inventory has enough space.
- Atomically remove Taka.
- Atomically reduce stock.
- Give item.
- Save transaction.
If ANY step fails:
- Do not remove Taka.
- Do not reduce stock.
- Do not give item.
This must prevent duplication and item-loss bugs.
==================================================
- STOCK SYSTEM
Support:
Finite stock:
Stock: 10
After one purchase:
Stock: 9
Also support:
Unlimited stock
Unlimited stock must never accidentally become negative.
Prevent negative stock values.
Prevent double-purchase caused by double clicking INVENTORY GUI buttons.
==================================================
- VENDING MACHINE INVENTORY GUI
Create a clean custom INVENTORY GUI.
Example:
VENDING MACHINE
[ Diamond ] Price: ৳500 Stock: 10
[ BUY ]
Admin:
[ ⚙ EDIT SHOP ]
Player:
No Edit button.
The INVENTORY GUI must automatically update after a successful purchase.
==================================================
- INVENTORY GUI SECURITY
This is critical.
Players must NOT be able to:
- Take INVENTORY GUI items.
- Shift-click INVENTORY GUI items.
- Drag INVENTORY GUI items.
- Double-click to collect INVENTORY GUI items.
- Number-key swap INVENTORY GUI items.
- Move items through hotbar.
- Insert items into protected INVENTORY GUI slots.
- Duplicate products through INVENTORY GUI interaction.
- Trigger buttons after the INVENTORY GUI is closed.
- Use stale INVENTORY GUI clicks after another INVENTORY GUI opens.
Handle all relevant InventoryClickEvent, InventoryDragEvent, InventoryMoveItemEvent and related events correctly.
Never trust client-side inventory state.
==================================================
- DATABASE
Use SQLite.
Tables should include at minimum:
players atm_locations vending_machines vending_products transactions
Use UUID as player identifier.
Use unique IDs for:
- ATM
- Vending Machine
- Products
- Physical money notes where required
Use prepared statements.
Do not perform unsafe SQL string concatenation.
Database writes must be safe and consistent.
==================================================
- TRANSACTION SAFETY
Economy transactions must be atomic.
Never allow:
Money removed + item not received.
Item removed + money not received.
Stock removed + purchase failed.
Bank balance changed twice.
Payment executed twice.
ATM withdrawal duplicated.
ATM deposit duplicated.
Use proper transaction handling and synchronization where necessary.
==================================================
- SERVER RESTART / RELOAD SAFETY
This is extremely important.
After:
- Server restart
- Plugin reload
- Player disconnect
- Player reconnect
- Crash recovery
All balances, ATM locations, vending machines, products and stock must remain correct.
DO NOT rely only on RAM.
Save critical data immediately.
Do not create duplicate ATM/machine records when the server restarts.
Do not duplicate physical money during reconnect/reload.
==================================================
- ANTI-DUPLICATION
Perform a full anti-duplication audit.
Test:
- Shift-click
- Double-click
- Dragging
- Hotbar swapping
- Dropping money
- Picking up money
- Hopper interaction
- Chest interaction
- Death
- Respawn
- Disconnect during transaction
- Reconnect
- Server restart
- Plugin reload
- Full inventory
- Item stacking
- Partial stacking
- Multiple players buying simultaneously
Physical money must never be duplicated.
Vending machine items must never be duplicated.
Bank money must never be duplicated.
==================================================
- RESOURCE PACK
Create a resource pack for:
৳1 note ৳5 note ৳10 note ৳20 note ৳50 note ৳100 note ৳500 note ৳1000 note ৳5000 note ৳10000 note
Also create custom visual designs for:
ATM Vending Machine
Use original designs for my SMP.
Do not copy copyrighted assets from the reference video.
The plugin must recognize the custom items using CustomModelData / modern item model system where appropriate for the target Minecraft version.
The plugin must still securely validate the items using PersistentDataContainer.
==================================================
- ADMIN PERMISSIONS
bdteconomy.admin
bdteconomy.atm.give
bdteconomy.atm.remove
bdteconomy.vending.give
bdteconomy.vending.edit
bdteconomy.money.give
bdteconomy.money.take
bdteconomy.money.set
bdteconomy.reload
Do not give normal players admin permissions.
==================================================
- CONFIGURATION
Create config.yml.
Allow configuration of:
Currency symbol Currency name Denominations ATM INVENTORY GUI title Vending Machine INVENTORY GUI title Vending Machine editor title Default prices Default stock Unlimited stock Messages Sounds Permissions Database settings Resource pack settings
All messages must be editable.
==================================================
- LOGGING
Log important transactions:
Player UUID Transaction type Amount Machine ID if applicable Product Timestamp
Examples:
PAY ATM_DEPOSIT ATM_WITHDRAW VENDING_PURCHASE ADMIN_GIVE ADMIN_TAKE
Do not log sensitive information such as passwords.
==================================================
- ERROR HANDLING
Never let an exception crash the server.
Use proper validation and exception handling.
If database connection fails:
- Do not perform unsafe economy transactions.
- Show an error.
- Log the problem.
Never silently lose player money.
==================================================
- TESTING REQUIREMENT
Before declaring the plugin finished, perform a complete test.
Test:
- New player account
- Existing player
- Restart
- Reload
- Disconnect
- Reconnect
- ATM deposit
- ATM withdrawal
- Full inventory
- Vending purchase
- Out of stock
- Insufficient money
- Multiple simultaneous purchases
- Admin editing
- Normal player permissions
- Fake money
- Renamed paper
- Item duplication attempts
- INVENTORY GUI exploits
- Hopper exploits
- Death/reconnect
- Database persistence
Fix every discovered bug.
Do NOT simply say “tested successfully” without actually checking the relevant code paths.
==================================================
- CODE QUALITY
Use clean modular architecture.
Recommended modules:
EconomyManager MoneyManager BankManager ATMManager VendingManager TransactionManager DatabaseManager GUIManager PermissionManager ItemManager ResourcePackManager CommandManager
Use interfaces/classes where appropriate.
Avoid giant single classes.
Use async database operations where safe, but NEVER access Bukkit API asynchronously when unsafe.
All Bukkit/Paper API operations must occur on the correct server thread.
==================================================
- FINAL REQUIREMENT
The final result must be a fully functional production-ready plugin.
Provide:
- Complete source code.
- plugin.yml.
- config.yml.
- SQLite database implementation.
- Resource pack.
- All commands.
- All permissions.
- Complete INVENTORY GUI system.
- ATM system.
- Physical Taka system.
- Shopkeepers-style Vending Machine system.
- Admin editor INVENTORY GUI.
- Anti-duplication protection.
- Restart/reload persistence.
- Complete testing and bug fixing.
Most importantly:
DO NOT leave TODOs.
DO NOT leave placeholder methods.
DO NOT provide pseudo-code.
DO NOT create incomplete features.
DO NOT claim a feature works unless it is actually implemented.
The plugin must compile successfully and work on the specified Paper 1.21.x server without requiring Vault or another economy plugin.
Create the Paper/Java 21 build, plugin metadata, configuration, and resource-pack assets.
Implement UUID-based SQLite persistence, atomic economy operations, transaction logging, and secure physical Taka items.
Implement protected ATM and vending-machine placement, interaction, breaking, and exploit-prevention listeners.
Implement balance/payment/admin commands and synchronized ATM/vending GUI flows, including the vending editor.
Review the generated code paths for persistence, permissions, GUI stale-click protection, inventory rollback, and transaction boundaries.
Added the complete standalone Paper 1.21.x BDT Economy project structure with Java 21, SQLite, plugin metadata, permissions, commands, configuration, resource-pack model definitions, and modular source classes.
Implemented UUID-based bank accounts, prepared SQLite statements, transaction logging, balance limits, atomic payments, admin account operations, and restart persistence.
Implemented secure PersistentDataContainer-backed BDT notes with denominations, unique note IDs, plugin-version validation, configurable custom model data, deposits, withdrawals, and physical-money protections.
Implemented ATM and vending-machine placement, persistent locations, permission-controlled breaking, piston/explosion/hopper protection, vending products, stock handling, editor GUI, shop-name editing, pricing, enabled state, unlimited stock, and purchasing.
Implemented protected GUI click/drag/move handling, stale-inventory checks, inventory snapshots for failed payouts, permissions, editable messages, and configurable GUI/economy settings.
The project files were created successfully. However, this environment does not provide Gradle, Java compilation, or a Paper test server, so an actual compile/runtime verification could not be performed here.
Create a production-ready Minecraft Paper plugin for my SMP called “BDT Economy”. The entire server economy must use Bangladeshi Taka (৳ / BDT). Do NOT use dollars, coins, Chaos Tokens, Vault money, or any other currency.
IMPORTANT:
Build this as ONE complete standalone plugin. The plugin must be stable, persistent, secure, and production-ready. Do not create a prototype or partially working system. Before finishing, thoroughly test every feature and fix all bugs, duplication exploits, item-loss bugs, INVENTORY GUI bugs, reload bugs, restart bugs, race conditions, permission bypasses, and economy exploits.
TARGET:
- Minecraft Paper 1.21.x
- Java 21+
- SQLite by default
- UUID-based player accounts
- Persistent data must survive server restart/reload
- No dependency on Vault
- No dependency on another economy plugin
==================================================
- CURRENCY — BANGLADESHI TAKA
==================================================
The only currency is Bangladeshi Taka (৳).
Supported physical denominations:
৳1 ৳5 ৳10 ৳20 ৳50 ৳100 ৳500 ৳1000 ৳5000 ৳10000
All denominations must be configurable.
Every physical Taka note must be a custom Minecraft item using a resource pack.
Each note must contain secure PersistentDataContainer data identifying:
- Currency type
- Denomination
- Unique note ID
- Plugin version
Never identify legitimate money only by display name or lore.
Players must not be able to create legitimate money simply by renaming an item in an anvil.
==================================================
- BANK ACCOUNT
Every player has a bank account stored by UUID.
Commands:
/balance /money
Display:
Wallet: ৳X Bank: ৳Y Total: ৳Z
The bank balance must be stored in SQLite.
Never use player names as the primary database key.
If a player changes their username, their money must remain.
==================================================
- PLAYER PAYMENTS
Command:
/pay <player> <amount>
Example:
/pay Redwan 500
Requirements:
- Cannot pay yourself.
- Amount must be positive.
- Cannot use negative values.
- Cannot use decimals unless decimals are explicitly enabled.
- Sender must have sufficient balance.
- Receiver must exist.
- Transaction must be atomic.
- Never remove money from sender unless receiver successfully receives it.
- Prevent double payment from repeated clicks/commands.
- Give clear success/failure messages.
==================================================
- ADMIN MONEY COMMANDS
Admin commands:
/economy give <player> <amount> /economy take <player> <amount> /economy set <player> <amount> /economy balance <player> /economy givephysical <player> <amount> /economy reload
Permissions:
bdteconomy.admin
Only authorized admins can use administrative economy commands.
Prevent integer overflow and invalid amounts.
==================================================
- ATM SYSTEM
Create a physical ATM system.
Admin command:
/economy giveatm
This gives an ATM placement item.
The ATM must be identifiable using PersistentDataContainer.
When an authorized player places the ATM, save its exact location in the database.
When a player right-clicks the ATM, open the ATM INVENTORY GUI.
ATM INVENTORY GUI must contain:
- Bank Balance
- Deposit
- Withdraw
- Close
Optional:
- Quick Withdraw
- Quick Deposit
- Transaction History
ATM INVENTORY GUI must be configurable.
==================================================
- ATM WITHDRAW
When player chooses Withdraw:
Show selectable amounts:
৳100 ৳500 ৳1000 ৳5000 ৳10000
Also provide a custom amount option.
Example:
Bank balance: ৳25,000
Player withdraws: ৳5,000
Result:
Bank: ৳20,000
Physical money: ৳5,000
The transaction MUST be atomic.
If the player's inventory is full, do NOT remove the money from the bank.
Instead show:
“Your inventory is full.”
If only part of the required physical money can fit, the transaction must fail completely unless the system safely supports partial transactions.
Never allow money duplication.
==================================================
- ATM DEPOSIT
Player can deposit legitimate physical Taka notes.
Example:
Inventory: ৳100 × 3 ৳500 × 2
Total: ৳1,300
Deposit:
Bank balance +৳1,300
Physical notes are removed.
Only genuine plugin-generated Taka items can be deposited.
Fake renamed paper/items must be rejected.
Handle stacked notes safely.
Never lose money if the transaction fails.
==================================================
- ATM BREAKING / SECURITY
Normal players must NOT be able to break placed ATMs.
Only authorized admins can remove them.
If an authorized admin breaks an ATM:
- Remove its database record.
- Give the ATM placement item back.
- Do not duplicate the ATM.
- Do not lose the ATM.
Prevent piston movement, hopper exploitation, container exploits, and other ways of bypassing protection.
If necessary, cancel unsupported block interactions/events.
==================================================
- VENDING MACHINE
Create a physical Vending Machine.
Admin command:
/economy givevending
The item can be placed in the world.
Save the machine location and a unique machine ID.
Each machine must have its own inventory/shop configuration.
Normal player:
Right-click Vending Machine → Open Shop INVENTORY GUI
==================================================
- SHOPKEEPERS-STYLE VENDING MACHINE EDITING
This is extremely important.
Make the Vending Machine editing experience similar to Shopkeepers-style INVENTORY GUI management.
Admins must NOT need commands every time they want to edit a vending machine.
When an authorized admin right-clicks a vending machine:
Open the normal Vending Machine INVENTORY GUI.
Add an:
⚙ EDIT SHOP
button.
Normal players must NEVER see the Edit Shop button.
Permission:
bdteconomy.vending.edit
When admin clicks:
⚙ EDIT SHOP
Open:
Vending Machine Editor INVENTORY GUI
==================================================
- VENDING MACHINE EDITOR
The editor must allow drag-and-drop configuration.
Admin can:
- Add item
- Remove item
- Change item
- Set buy price
- Set sell price if selling is enabled
- Set stock
- Add stock
- Remove stock
- Set unlimited stock
- Change shop name
- Change item display name
- Enable/disable item
- Save changes
- Cancel changes
Example:
Diamond
Buy Price: ৳500
Stock: 10
Player sees:
Diamond Price: ৳500 Stock: 10
[ BUY ]
The editor must support multiple products per machine.
==================================================
- VENDING MACHINE TRANSACTIONS
When player buys an item:
- Verify machine exists.
- Verify product exists.
- Verify product is enabled.
- Verify stock.
- Verify price.
- Verify player has enough Taka.
- Verify inventory has enough space.
- Atomically remove Taka.
- Atomically reduce stock.
- Give item.
- Save transaction.
If ANY step fails:
- Do not remove Taka.
- Do not reduce stock.
- Do not give item.
This must prevent duplication and item-loss bugs.
==================================================
- STOCK SYSTEM
Support:
Finite stock:
Stock: 10
After one purchase:
Stock: 9
Also support:
Unlimited stock
Unlimited stock must never accidentally become negative.
Prevent negative stock values.
Prevent double-purchase caused by double clicking INVENTORY GUI buttons.
==================================================
- VENDING MACHINE INVENTORY GUI
Create a clean custom INVENTORY GUI.
Example:
VENDING MACHINE
[ Diamond ] Price: ৳500 Stock: 10
[ BUY ]
Admin:
[ ⚙ EDIT SHOP ]
Player:
No Edit button.
The INVENTORY GUI must automatically update after a successful purchase.
==================================================
- INVENTORY GUI SECURITY
This is critical.
Players must NOT be able to:
- Take INVENTORY GUI items.
- Shift-click INVENTORY GUI items.
- Drag INVENTORY GUI items.
- Double-click to collect INVENTORY GUI items.
- Number-key swap INVENTORY GUI items.
- Move items through hotbar.
- Insert items into protected INVENTORY GUI slots.
- Duplicate products through INVENTORY GUI interaction.
- Trigger buttons after the INVENTORY GUI is closed.
- Use stale INVENTORY GUI clicks after another INVENTORY GUI opens.
Handle all relevant InventoryClickEvent, InventoryDragEvent, InventoryMoveItemEvent and related events correctly.
Never trust client-side inventory state.
==================================================
- DATABASE
Use SQLite.
Tables should include at minimum:
players atm_locations vending_machines vending_products transactions
Use UUID as player identifier.
Use unique IDs for:
- ATM
- Vending Machine
- Products
- Physical money notes where required
Use prepared statements.
Do not perform unsafe SQL string concatenation.
Database writes must be safe and consistent.
==================================================
- TRANSACTION SAFETY
Economy transactions must be atomic.
Never allow:
Money removed + item not received.
Item removed + money not received.
Stock removed + purchase failed.
Bank balance changed twice.
Payment executed twice.
ATM withdrawal duplicated.
ATM deposit duplicated.
Use proper transaction handling and synchronization where necessary.
==================================================
- SERVER RESTART / RELOAD SAFETY
This is extremely important.
After:
- Server restart
- Plugin reload
- Player disconnect
- Player reconnect
- Crash recovery
All balances, ATM locations, vending machines, products and stock must remain correct.
DO NOT rely only on RAM.
Save critical data immediately.
Do not create duplicate ATM/machine records when the server restarts.
Do not duplicate physical money during reconnect/reload.
==================================================
- ANTI-DUPLICATION
Perform a full anti-duplication audit.
Test:
- Shift-click
- Double-click
- Dragging
- Hotbar swapping
- Dropping money
- Picking up money
- Hopper interaction
- Chest interaction
- Death
- Respawn
- Disconnect during transaction
- Reconnect
- Server restart
- Plugin reload
- Full inventory
- Item stacking
- Partial stacking
- Multiple players buying simultaneously
Physical money must never be duplicated.
Vending machine items must never be duplicated.
Bank money must never be duplicated.
==================================================
- RESOURCE PACK
Create a resource pack for:
৳1 note ৳5 note ৳10 note ৳20 note ৳50 note ৳100 note ৳500 note ৳1000 note ৳5000 note ৳10000 note
Also create custom visual designs for:
ATM Vending Machine
Use original designs for my SMP.
Do not copy copyrighted assets from the reference video.
The plugin must recognize the custom items using CustomModelData / modern item model system where appropriate for the target Minecraft version.
The plugin must still securely validate the items using PersistentDataContainer.
==================================================
- ADMIN PERMISSIONS
bdteconomy.admin
bdteconomy.atm.give
bdteconomy.atm.remove
bdteconomy.vending.give
bdteconomy.vending.edit
bdteconomy.money.give
bdteconomy.money.take
bdteconomy.money.set
bdteconomy.reload
Do not give normal players admin permissions.
==================================================
- CONFIGURATION
Create config.yml.
Allow configuration of:
Currency symbol Currency name Denominations ATM INVENTORY GUI title Vending Machine INVENTORY GUI title Vending Machine editor title Default prices Default stock Unlimited stock Messages Sounds Permissions Database settings Resource pack settings
All messages must be editable.
==================================================
- LOGGING
Log important transactions:
Player UUID Transaction type Amount Machine ID if applicable Product Timestamp
Examples:
PAY ATM_DEPOSIT ATM_WITHDRAW VENDING_PURCHASE ADMIN_GIVE ADMIN_TAKE
Do not log sensitive information such as passwords.
==================================================
- ERROR HANDLING
Never let an exception crash the server.
Use proper validation and exception handling.
If database connection fails:
- Do not perform unsafe economy transactions.
- Show an error.
- Log the problem.
Never silently lose player money.
==================================================
- TESTING REQUIREMENT
Before declaring the plugin finished, perform a complete test.
Test:
- New player account
- Existing player
- Restart
- Reload
- Disconnect
- Reconnect
- ATM deposit
- ATM withdrawal
- Full inventory
- Vending purchase
- Out of stock
- Insufficient money
- Multiple simultaneous purchases
- Admin editing
- Normal player permissions
- Fake money
- Renamed paper
- Item duplication attempts
- INVENTORY GUI exploits
- Hopper exploits
- Death/reconnect
- Database persistence
Fix every discovered bug.
Do NOT simply say “tested successfully” without actually checking the relevant code paths.
==================================================
- CODE QUALITY
Use clean modular architecture.
Recommended modules:
EconomyManager MoneyManager BankManager ATMManager VendingManager TransactionManager DatabaseManager GUIManager PermissionManager ItemManager ResourcePackManager CommandManager
Use interfaces/classes where appropriate.
Avoid giant single classes.
Use async database operations where safe, but NEVER access Bukkit API asynchronously when unsafe.
All Bukkit/Paper API operations must occur on the correct server thread.
==================================================
- FINAL REQUIREMENT
The final result must be a fully functional production-ready plugin.
Provide:
- Complete source code.
- plugin.yml.
- config.yml.
- SQLite database implementation.
- Resource pack.
- All commands.
- All permissions.
- Complete INVENTORY GUI system.
- ATM system.
- Physical Taka system.
- Shopkeepers-style Vending Machine system.
- Admin editor INVENTORY GUI.
- Anti-duplication protection.
- Restart/reload persistence.
- Complete testing and bug fixing.
Most importantly:
DO NOT leave TODOs.
DO NOT leave placeholder methods.
DO NOT provide pseudo-code.
DO NOT create incomplete features.
DO NOT claim a feature works unless it is actually implemented.
The plugin must compile successfully and work on the specified Paper 1.21.x server without requiring Vault or another economy plugin.
Inspect the existing Gradle project and determine the current plugin scaffold and available dependencies.
Implement the persistent SQLite economy, secure physical Taka items, balances, payments, and admin commands.
Implement protected ATM placement, deposits/withdrawals, and GUI flows.
Implement vending machines, persistent products/stock, editor GUI, and atomic purchases.
Add configuration, resource-pack assets/metadata, permissions, and perform a code-level security/persistence audit.
Task 1 is already scaffolded for Paper 1.21.x, Java 21, SQLite, and the bundled resource-pack layout, so no dependency change is needed. I’m replacing the unsafe persistence and money core first; the existing database code currently allows stale-price purchases, has incomplete machine identity validation, and does not safely enforce all balance invariants.
Core persistence is now transaction-guarded with SQLite constraints, prepared statements, balance overflow checks, stale-product price checks, and secure note/machine PDC validation. Next I’m hardening the world interaction and command boundary: only genuine versioned machine items may place, machine identity is stored on the block, protected blocks cannot be moved or container-accessed, and admin subcommands use their declared permissions.
The command and block boundary is hardened. I found two concrete GUI/economy issues that must be fixed before the GUI layer is considered safe: ATM deposits were logged as admin grants, and a copied/split legitimate note could be deposited repeatedly because its PDC ID was never consumed. I’m adding a database-side note-consumption ledger and correcting the ATM/editor transaction paths.
The GUI click path already cancels top/bottom clicks, shift-clicks, number-key swaps, and stale-holder clicks. I’m fixing the remaining concrete item-loss risk now: Bukkit inventory mutation can mutate the same ItemStack objects retained in a shallow snapshot, so rollback could fail after partial insertion. All rollback snapshots will be deep copies, and editor drag insertion will remain cancelled-and-applied only through validated server-side state.
The remaining audit found no dangling NoteStack usages, but two admin/block-break rollback paths still used shallow inventory snapshots. I’m correcting those and tightening machine-item validation to require the expected barrel and marker value, then adding a protected-container-open guard so stored machine blocks cannot be accessed through alternate interaction paths.
Implemented the standalone BDT Economy plugin across the existing project.
Key changes:
SQLite persistence with UUID accounts, balance constraints, WAL mode, prepared statements, and transaction logging.
Bangladeshi Taka-only currency formatting using
৳.Secure PDC-backed physical notes with denomination, UUID note ID, currency type, and plugin version.
Anti-duplication ledger for deposited physical notes.
Atomic payments, admin balance operations, ATM deposits/withdrawals, and vending purchases.
Inventory rollback snapshots now deep-copy item stacks.
Protected ATM and vending machines with persistent locations and block PDC identity.
Machine placement permission checks, protected breaking, piston/explosion/hopper protection, and container-open protection.
Protected GUI interactions including clicks, shift-clicks, drag operations, hotbar swaps, and stale-holder checks.
Vending editor support for products, prices, stock, unlimited stock, enabled state, replacement items, cancellation recovery, and persistent saving.
Admin permission enforcement for machine placement and economy commands.
Player account initialization on join and GUI input cleanup on quit.
Configurable messages for all newly added failure/success paths.
Existing resource-pack model structure retained for Taka, ATM, and vending visuals.
I also corrected several concrete issues found during the audit, including:
ATM deposits incorrectly being logged as admin grants.
Physical note IDs not being consumed on deposit.
Stale vending product prices being trusted during purchases.
Vending purchases not validating the machine/product relationship.
Inventory rollback using shallow item snapshots.
Machine items being accepted without strict material, marker, and version validation.
GUI drag handling allowing unsafe editor behavior.
Vending editor items potentially being lost during cancellation or reload.
The project is configured for Paper 1.21.x, Java 21, SQLite, and no Vault or external economy dependency. Compilation/runtime verification must still be performed by the project verifier on the resulting source.
package com.bdt.economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
import java.sql.SQLException;
public final class BDTEconomyPlugin extends JavaPlugin implements Listener {
private DatabaseManager database; private EconomyService economy; private MoneyItemManager money; private MachineManager machines; private GUIManager gui;
@Override public void onEnable(){saveDefaultConfig();try{database=new DatabaseManager(this);}catch(SQLException|IOException e){getLogger().severe("Database startup failed: "+e.getMessage());getServer().getPluginManager().disablePlugin(this);return;}money=new MoneyItemManager(this);economy=new EconomyService(this,database);machines=new MachineManager(this,database,money);gui=new GUIManager(this,database,economy,money);getServer().getPluginManager().registerEvents(this,this);getServer().getPluginManager().registerEvents(gui,this);register("balance",new BalanceCommand(this));register("money",new BalanceCommand(this));register("pay",new PayCommand(this));register("economy",new EconomyCommand(this));}
private void register(String name,CommandExecutor executor){PluginCommand c=getCommand(name);if(c!=null)c.setExecutor(executor);}
@Override public void onDisable(){if(gui!=null)gui.closeAll();if(database!=null)database.close();}
@EventHandler public void place(BlockPlaceEvent e){machines.place(e);}
@EventHandler public void breakBlock(BlockBreakEvent e){machines.breakBlock(e);}
@EventHandler public void interact(PlayerInteractEvent e){machines.interact(e);}
@EventHandler public void piston(BlockPistonExtendEvent e){machines.piston(e);}
@EventHandler public void piston(BlockPistonRetractEvent e){machines.piston(e);}
@EventHandler public void blockExplode(BlockExplodeEvent e){machines.explode(e);}
@EventHandler public void entityExplode(EntityExplodeEvent e){machines.explode(e);}
@EventHandler public void hopper(InventoryMoveItemEvent e){machines.hopper(e);}
@EventHandler public void openContainer(InventoryOpenEvent e){if(e.getInventory().getLocation()!=null&&machines.protectedBlock(e.getInventory().getLocation().getBlock()))e.setCancelled(true);}
@EventHandler public void join(PlayerJoinEvent e){try{database.ensurePlayer(e.getPlayer().getUniqueId());}catch(SQLException ex){fail(ex);}}
@EventHandler public void quit(PlayerQuitEvent e){if(gui!=null)gui.clearInput(e.getPlayer().getUniqueId());}
public DatabaseManager database(){return database;} public EconomyService economy(){return economy;} public MoneyItemManager money(){return money;} public GUIManager gui(){return gui;}
public String money(long amount){return getConfig().getString("currency.symbol","৳")+String.format("%,d",amount);}
public String message(String key){return message(key,java.util.Map.of());}
public String message(String key,java.util.Map<String,String> values){String s=getConfig().getString("messages.prefix","")+getConfig().getString("messages."+key,key);for(var e:values.entrySet())s=s.replace("{"+e.getKey()+"}",e.getValue());return ChatColor.translateAlternateColorCodes('&',s).replace("\\n","\n");}
public void fail(Exception ex){getLogger().warning("Economy operation failed: "+ex.getMessage());}
public void reloadEconomy(){reloadConfig();}
}