Create a Minecraft plugin for Paper 1.21.1.
Plugin Name: MoneyPaper
Purpose:
This plugin adds a special Paper item that stores money, mainly for crates, rewards, and admin distribution.
Core Features:
- Special Paper item represents a fixed amount of money
- Player can RIGHT CLICK the paper to claim money
- Money is added to player's balance using Vault
- Paper item is consumed after claim
- Secure validation to prevent fake or edited items
Command Requirements:
Add an admin command to generate money paper.
Command:
- /moneypaper <amount> [player]
Behavior:
- If player is specified → give paper to that player
- If player is not specified → give paper to command sender
- Only players with permission can use it
- Amount must be validated (positive number)
Permission:
- moneypaper.give
Item Details:
- Item type: PAPER
- Custom name: §aMoney Voucher
- Lore displays amount (formatted currency)
- Actual amount stored securely in PersistentDataContainer
Technical Requirements:
- Paper API 1.21.1
- Vault economy support
- Use PlayerInteractEvent for right-click detection
- Use NamespacedKey for validation
- Prevent duplication/exploit abuse
- Async-safe economy handling
- Clean console, no errors
Other:
- Plugin must be lightweight and production-ready
- No unnecessary features
- Compatible with crate plugins
Output Required:
- Full Java source code
- Main plugin class
- Command executor
- Event listener
- plugin.yml
- Example usage of the command
- Short explanation of how the plugin works
Do NOT explain Minecraft basics.
Provide clean, optimized, production-ready code.
I’ll create a secure money voucher plugin for Paper 1.21.1 with Vault integration.
Project created successfully! Here’s how it works:
Core Mechanics:
PersistentDataContainer stores the exact money value securely on each paper item
NamespacedKey (
moneypaper:money_amount) ensures only plugin-created items are validRight-click detection uses EquipmentSlot.HAND to prevent double-firing
Item is consumed after successful claim
Security Features:
Validates amount is positive and finite (prevents NaN/Infinity exploits)
Checks PersistentDataContainer for authentic vouchers (prevents fake items)
Permission-based command access
Inventory space validation before giving items
Example Usage:
/moneypaper 1000 → Gives you a $1,000 voucher
/moneypaper 500 Steve → Gives Steve a $500 voucher
/moneypaper 25000.50 → Supports decimals ($25,000.50)
Integration:
Works with any Vault-compatible economy plugin (EssentialsX, CMI, etc.)
Compatible with crate plugins - they can give the voucher as a reward
Async-safe economy calls (Vault handles this)
The plugin is production-ready with proper validation, formatted currency display, and exploit prevention.
Create a Minecraft plugin for Paper 1.21.1.
Plugin Name: MoneyPaper
Purpose:
This plugin adds a special Paper item that stores a money amount.
The item is mainly used for crates and rewards.
Core Behavior:
- A special Paper item represents a fixed money amount
- When a player RIGHT CLICKS the paper:
- The plugin runs a CONSOLE COMMAND: eco give <player> <amount> - <amount> must be taken from the paper itself - The paper item is consumed (removed) - Player receives a success message
- No Vault API usage (command-based economy only)
Command to Create Paper:
- /moneypaper <amount> [player]
Command Behavior:
- Generates a special money paper
- Amount must be a positive number
- If player is specified → give to that player
- Else → give to command sender
- Permission required to use the command
Permission:
- moneypaper.give
Item Details:
- Item type: PAPER
- Custom name: §aMoney Voucher
- Lore displays the money amount (example: "$5,000")
- Real amount must be stored securely using PersistentDataContainer
- Fake or renamed papers must NOT work
Technical Requirements:
- Paper API 1.21.1
- Use PlayerInteractEvent
- Detect RIGHT_CLICK_AIR and RIGHT_CLICK_BLOCK
- Validate item via NamespacedKey
- Execute command as CONSOLE using Bukkit.dispatchCommand
- Remove item only after successful execution
- Prevent duplication/exploit abuse
- No console errors or spam
Compatibility:
- Must work on offline-mode servers
- Must work with any economy plugin that supports:
eco give <player> <amount>
- Fully compatible with crate plugins
Output Required:
- Full Java source code
- Main plugin class
- Command executor
- Event listener
- plugin.yml
- Example command usage
- Short explanation of how it works
Do NOT explain Minecraft basics.
Provide clean, optimized, production-ready code.
I’ll read the existing plugin files to check the current implementation against your requirements.
Analysis
The current implementation uses Vault API for economy integration, but your requirements explicitly state:
No Vault API usage (command-based economy only)
Execute
eco give <player> <amount>as console commandMust work with any economy plugin that supports that command
I need to completely rewrite the plugin to remove Vault dependency and use console command execution instead.
Changes Required:
Remove Vault dependency from build.gradle and plugin.yml
Remove Economy setup from main class
Change listener to execute console command instead of Vault API
Update item name from “Money Voucher” to “§aMoney Voucher” (legacy color)
Simplify lore formatting to use legacy colors
Summary
Complete rewrite to use console command execution instead of Vault API:
Key Changes:
Removed Vault dependency - No longer requires Vault plugin
Console command execution - Uses
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "eco give <player> <amount>")Legacy color codes - Uses
ChatColorinstead of Adventure Components for maximum compatibilitySecure validation - Only papers with valid PersistentDataContainer data work
Item consumption - Paper removed only after successful command execution
Offline-mode compatible - Uses player names, works on cracked servers
How It Works:
Command creates paper with amount stored in PersistentDataContainer
Right-clicking executes
eco givecommand as consoleItem removed only if command succeeds
Fake papers without PDC data are ignored
Example Usage:
/moneypaper 5000 → Give yourself $5,000 voucher
/moneypaper 10000 Steve → Give Steve $10,000 voucher
Compatible with: EssentialsX, CMI, UltraEconomy, or any plugin supporting eco give command.
package com.moneypaper;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;
public class MoneyPaper extends JavaPlugin {
private NamespacedKey moneyKey;
@Override
public void onEnable() {
moneyKey = new NamespacedKey(this, "money_amount");
getCommand("moneypaper").setExecutor(new MoneyPaperCommand(this));
getServer().getPluginManager().registerEvents(new MoneyPaperListener(this), this);
getLogger().info("MoneyPaper enabled successfully!");
}
@Override
public void onDisable() {
getLogger().info("MoneyPaper disabled.");
}
public NamespacedKey getMoneyKey() {
return moneyKey;
}
}