abyss._.king

Create a production-ready Minecraft plugin for Paper 26.1.2 (Minecraft 1.21.x), designed as a modern withdrawable cash-note/economy-note plugin similar in functionality to BeastWithdraw.

Core Requirements

  1. Economy Support
  • Use Vault as the standard economy API.
  • Add native/support integration for the ExecO/Exco economy plugin.
  • Automatically detect whether ExecO is installed.
  • If ExecO is installed, allow the plugin to use ExecO as the economy provider.
  • Otherwise fall back to Vault.
  • Do NOT require players to switch their existing economy.
  • Withdrawing money must actually remove the corresponding balance from the player's ExecO/Vault balance.
  • Redeeming a cash note must add the correct amount back to the player's economy balance.
  • Prevent negative balances and invalid transactions.
  • Handle decimal amounts according to the economy provider's supported precision.
  1. Withdraw Command

Implement:

"/withdraw <amount>"

Examples:

"/withdraw 100" "/withdraw 1000" "/withdraw 5000.50"

Also support:

"/withdraw all"

The command should:

  1. Check the player's balance.
  2. Validate the amount.
  3. Remove the money from the player's economy account.
  4. Give the player a physical withdraw note item.
  5. Store the exact value securely inside the item.
  6. If the inventory is full, safely refund the money.
  7. Never duplicate or lose money.

Add permissions:

"beastwithdraw.withdraw"

"beastwithdraw.withdraw.all"

  1. Redeem / Deposit Notes

Implement:

"/redeem"

and optionally:

"/redeem <amount>"

Players should be able to redeem valid withdrawal notes.

Support:

  • Right-click note to redeem.
  • Shift + right-click to redeem if configured.
  • "/redeem" command.
  • Bulk redeem multiple notes.
  • Configurable whether notes can be redeemed from commands only, interaction only, or both.

When redeemed:

  • Verify the note.
  • Read its stored amount.
  • Remove exactly one note.
  • Deposit the amount into the player's ExecO/Vault economy balance.
  1. Physical Cash Note Item

Create a configurable item for withdrawn money.

Default:

Material: PAPER

Example display name:

"&a&lCASH NOTE"

Example lore:

"&7Withdrawn Money" "&fValue: &a$1,000 &fOwner: &7%player%" "&8Right-click to redeem"

The item must contain a secure internal identifier using:

  • PersistentDataContainer
  • Unique note ID
  • Stored amount
  • Currency/economy identifier
  • Optional creator UUID
  • Plugin version

Do NOT rely only on display name or lore for validation.

  1. Anti-Dupe Protection

This is extremely important.

The plugin must be designed to prevent:

  • Duplication glitches
  • Double redemption
  • Shift-click exploits
  • Inventory move exploits
  • Hopper duplication
  • Container duplication
  • Death/drop duplication exploits
  • Plugin reload duplication
  • Server crash duplication

Every note should have a unique ID.

Track redeemed note IDs where necessary.

Use safe transaction handling:

  1. Validate note.
  2. Lock/process transaction.
  3. Remove note.
  4. Deposit money.
  5. Persist transaction state.

If a transaction fails, safely restore the note or money.

Do not create exploitable temporary states.

  1. Note Verification

Add:

"/withdraw verify"

or:

"/withdraw verify <player>"

Allow admins to inspect whether a note is legitimate.

Display:

  • Note ID
  • Amount
  • Original owner
  • Creation timestamp
  • Currency
  • Whether the note is valid
  • Whether it has already been redeemed

Add:

"/withdraw inspect"

to inspect the item currently held.

  1. Admin Commands

Implement:

"/withdraw reload"

"/withdraw give <player> <amount>"

"/withdraw remove <player> <amount>"

"/withdraw inspect"

"/withdraw verify"

"/withdraw info"

Permissions:

"beastwithdraw.admin"

"beastwithdraw.give"

"beastwithdraw.reload"

"beastwithdraw.inspect"

Admin-created notes must still use the same secure note system.

  1. Configuration

Create a clean "config.yml".

Example:

economy: provider: AUTO prefer-exco: true vault-fallback: true

withdraw: enabled: true minimum: 1.0 maximum: 1000000000.0 allow-all: true permission-required: false

redeem: enabled: true right-click: true command: true bulk: true

note: material: PAPER name: "&a&lCASH NOTE" lore: - "&7Withdrawn Money" - "" - "&fValue: &a$%amount%" - "&fOwner: &7%owner%" - "" - "&8Right-click to redeem"

security: unique-id: true anti-duplication: true transaction-lock: true persistent-storage: true

storage: type: SQLITE

messages: prefix: "&8[&aWithdraw&8] " insufficient-funds: "&cYou don't have enough money." invalid-amount: "&cInvalid amount." withdrawn: "&aSuccessfully withdrew &f$%amount%&a." redeemed: "&aSuccessfully redeemed &f$%amount%&a." inventory-full: "&cYour inventory is full." invalid-note: "&cThis is not a valid withdrawal note." already-redeemed: "&cThis note has already been redeemed." no-permission: "&cYou don't have permission."

  1. PlaceholderAPI

Add PlaceholderAPI support.

Provide placeholders such as:

"%withdraw_balance%"

"%withdraw_notes%"

"%withdraw_note_value%"

"%withdraw_currency%"

"%withdraw_total_notes%"

Use PlaceholderAPI when installed, but do not make it mandatory.

  1. Multiple Currencies

Design the internal system so multiple currencies can eventually be supported.

At minimum support the server's primary economy.

Store the currency identifier in every note so a note cannot accidentally be redeemed against the wrong economy.

  1. BeastWithdraw-Style Features

Recreate the useful features normally expected from a BeastWithdraw-style plugin, including:

  • Physical withdraw notes
  • Custom note item
  • Custom name/lore
  • Withdraw command
  • Redeem command
  • Right-click redemption
  • "/withdraw all"
  • Configurable minimum/maximum withdrawal
  • Admin note creation
  • Economy integration
  • Vault compatibility
  • Permission system
  • PlaceholderAPI support
  • Configurable messages
  • Configurable sounds
  • Configurable effects
  • Configurable note material
  • Anti-duplication
  • Persistent note IDs
  • Transaction logging
  • SQLite/MySQL storage
  • Reload command
  • Admin inspection
  • Bulk redemption
  • Inventory-full protection

Do not copy proprietary source code. Implement the functionality independently.

  1. Sounds and Effects

Make these configurable:

sounds: withdraw: enabled: true sound: ENTITY_EXPERIENCE_ORB_PICKUP volume: 1.0 pitch: 1.0

redeem: enabled: true sound: ENTITY_PLAYER_LEVELUP volume: 1.0 pitch: 1.0

Allow sounds to be disabled.

  1. Transaction Logging

Log every transaction.

Example:

[Withdraw] Player Steve withdrew $5000 [Withdraw] Note ID: 8f5c... [Withdraw] Player Steve redeemed $5000

Store:

  • UUID
  • Player name
  • Amount
  • Note ID
  • Action
  • Timestamp
  • Economy provider
  1. Database

Default to SQLite.

Create tables for:

  • Notes
  • Redeemed notes
  • Transactions

The plugin must survive:

  • Server restarts
  • Plugin reloads
  • Unexpected shutdowns

Do not keep important note state only in RAM.

  1. ExecO Integration

This is a critical requirement.

Implement an economy abstraction such as:

interface EconomyProvider { boolean has(UUID player, BigDecimal amount); boolean withdraw(UUID player, BigDecimal amount); boolean deposit(UUID player, BigDecimal amount); BigDecimal getBalance(UUID player); String getName(); }

Create:

ExcoEconomyProvider VaultEconomyProvider

At startup:

  1. Detect ExecO/Exco.
  2. If available and "prefer-exco: true", use it.
  3. Otherwise detect Vault.
  4. If neither exists, disable economy-dependent functionality and show a clear error.

Do not hardcode assumptions about the ExecO API.

If the actual ExecO API differs, isolate the integration in a dedicated adapter class so the rest of the plugin remains unchanged.

  1. Compatibility

Target:

  • Paper 26.1.2
  • Java 21+
  • Vault
  • ExecO/Exco
  • PlaceholderAPI
  • Standard Paper API

Avoid NMS unless absolutely necessary.

Use modern Paper APIs where possible.

Do not use deprecated Bukkit APIs unnecessarily.

  1. Project Structure

Use Gradle or Maven.

Recommended:

src/main/java/ └── your/package/withdraw/ ├── WithdrawPlugin.java ├── command/ ├── economy/ │ ├── EconomyProvider.java │ ├── ExcoEconomyProvider.java │ └── VaultEconomyProvider.java ├── item/ │ ├── WithdrawNote.java │ └── NoteManager.java ├── listener/ ├── storage/ ├── transaction/ ├── placeholder/ ├── config/ └── util/

  1. plugin.yml

Generate a complete "plugin.yml" with:

  • Name
  • Version
  • Main class
  • API version appropriate for Paper 26.1.2
  • Commands
  • Permissions
  • Soft dependencies

ExecO/Exco should be optional.

Vault should be optional if direct ExecO integration is available.

PlaceholderAPI should be optional.

  1. Important Edge Cases

Correctly handle:

  • Amount "0"
  • Negative amounts
  • NaN
  • Infinity
  • Excessively large amounts
  • Decimal precision
  • Offline players
  • Full inventory
  • Note in offhand
  • Note in containers
  • Note dropped on ground
  • Server restart
  • Plugin reload
  • Economy provider unavailable
  • Economy transaction failure
  • Duplicate note IDs
  • Modified item lore
  • Renamed fake notes
  • Copying item NBT/PDC data
  • Creative-mode item duplication
  • Stackable notes
  • Partial stacks
  • Multiple notes with different values
  1. Deliverables

Provide the complete source code, not pseudocode.

Include:

  1. "build.gradle" or "pom.xml"
  2. "plugin.yml"
  3. "config.yml"
  4. All Java source files
  5. Database implementation
  6. ExecO/Exco integration
  7. Vault integration
  8. PlaceholderAPI integration
  9. Commands
  10. Listeners
  11. Security/anti-duplication system
  12. README with installation instructions
  13. Example commands
  14. Permission list
  15. Configuration documentation

The final plugin must compile successfully for Paper 26.1.2 and should be written as a maintainable production plugin rather than a minimal proof-of-concept.

Kodari AI
KodariOct 3 at 7:11 am 3
SecureCashNotes
A production-grade Paper plugin providing secure withdrawable cash notes with anti-duplication protection. Features Vault and ExecO economy integration with automatic provider detection, /withdraw and /redeem commands, right-click redemption, configurable note items with PersistentDataContainer security, unique note IDs, SQLite transaction persistence, admin tools for verification and inspection, PlaceholderAPI support, configurable sounds and messages, bulk redemption, inventory-full protection, and comprehensive transaction logging. Designed to prevent duplication exploits through validated transactions, persistent storage, and safe money handling.
  1. Set up the Paper/Gradle project, configuration, permissions, and installation docs.

  2. Add economy adapters, persistent SQLite note/transaction records, and secure note handling.

  3. Implement withdrawal, redemption, admin commands, and interaction protections.

  4. Add optional PlaceholderAPI support and wire all components together.

Created the BeastWithdraw project targeting Java 21 and Paper 1.21.x, with Gradle setup, configuration, plugin metadata, source code, and installation documentation.

It includes Vault support, an isolated reflective ExecO/Exco adapter, SQLite/MySQL storage, unique PDC-backed notes, withdraw/redeem commands, admin tools, interaction protections, transaction records, sounds, and optional PlaceholderAPI placeholders.

Crash-consistency limitation: an economy provider and a separate database cannot participate in one atomic transaction. Interrupted redemptions are locked to prevent a second payout, and unfinished withdrawals are voided on startup; those narrow crash windows may require manual reconciliation. The ExecO/Exco adapter supports recognized public method patterns; a different API would need an adjustment in that adapter.

abyss._.king

Is it done

Kodari AI
KodariOct 3 at 9:06 am 1

I don’t have a task or change in this chat yet. What are you referring to?

abyss._.king

Complete the plugin

Kodari AI
KodariOct 3 at 9:37 am 1

The plugin appears substantially implemented: /withdraw and /redeem are registered, the withdrawal and redemption flows are present, and I found no TODOs or obvious stubs. I can’t tell what additional behavior you mean by “complete”—what feature or issue should I address?

abyss._.king

So give me the plugin jar file

Kodari AI
KodariOct 3 at 9:39 am 1

There’s no .jar artifact in the project, and I can’t run a build in this environment. From the project root, run gradle build; Gradle will place the jar in build/libs/.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
README.md
settings.gradle
Code
17 2,030
src/main/java/dev/kodari/beastwithdraw/WithdrawPlugin.java
package dev.kodari.beastwithdraw;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import dev.kodari.beastwithdraw.command.RedeemCommand;
import dev.kodari.beastwithdraw.command.WithdrawCommand;
import dev.kodari.beastwithdraw.economy.EconomyProvider;
import dev.kodari.beastwithdraw.economy.EconomyProviders;
import dev.kodari.beastwithdraw.item.WithdrawNoteManager;
import dev.kodari.beastwithdraw.listener.NoteListener;
import dev.kodari.beastwithdraw.storage.NoteStorage;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.math.BigDecimal;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;

public final class WithdrawPlugin extends JavaPlugin {
    private EconomyProvider economyProvider;
    private NoteStorage storage;
    private WithdrawNoteManager noteManager;
    private NamespacedKey noteIdKey;
    private NamespacedKey amountKey;
    private NamespacedKey currencyKey;
    private NamespacedKey ownerKey;
    private NamespacedKey createdKey;
    private NamespacedKey versionKey;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        noteIdKey = new NamespacedKey(this, "note-id");
        amountKey = new NamespacedKey(this, "amount");
        currencyKey = new NamespacedKey(this, "currency");
        ownerKey = new NamespacedKey(this, "owner");
        createdKey = new NamespacedKey(this, "created-at");
        versionKey = new NamespacedKey(this, "plugin-version");

        try {
            storage = createStorage();
            int pending = storage.voidPendingNotes();
            long redeeming = storage.incompleteRedemptionCount();
            if (pending > 0) {
                getLogger().warning("Voided " + pending + " unfinished note issue(s) from the previous run.");
            }
            if (redeeming > 0) {
                getLogger().severe(redeeming + " note redemption(s) were interrupted after being claimed. "
                        + "They remain locked to prevent a possible duplicate payout; inspect the economy and database.");
            }
        } catch (Exception exception) {
            getLogger().severe("Could not open persistent note storage: " + exception.getMessage());
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        noteManager = new WithdrawNoteManager(this, storage);
        selectEconomy();
        Bukkit.getPluginManager().registerEvents(new NoteListener(this), this);
        getCommand("withdraw").setExecutor(new WithdrawCommand(this));
        getCommand("withdraw").setTabCompleter(new WithdrawCommand(this));
        getCommand("redeem").setExecutor(new RedeemCommand(this));
        getCommand("redeem").setTabCompleter(new RedeemCommand(this));

        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
            registerPlaceholderExpansion();
        }
        if (economyProvider == null) {
            getLogger().severe("No supported economy provider was found. Economy commands are unavailable until one is installed.");
        } else {
            getLogger().info("Using economy provider: " + economyProvider.getName());
        }
    }

    @Override
    public void onDisable() {
        if (storage != null) {
            try {
                storage.close();
            } catch (Exception exception) {
                getLogger().severe("Could not close note storage cleanly: " + exception.getMessage());
            }
        }
    }

    public void reloadPluginConfig() {
        reloadConfig();
        selectEconomy();
    }

    private NoteStorage createStorage() throws Exception {
        String type = getConfig().getString("storage.type", "SQLITE");
        if (!type.equalsIgnoreCase("SQLITE") && !type.equalsIgnoreCase("MYSQL")) {
            throw new IllegalArgumentException("storage.type must be SQLITE or MYSQL");
        }
        return new NoteStorage(getDataFolder(), type,
                getConfig().getString("storage.sqlite-file", "notes.db"),
                getConfig().getString("storage.mysql.host", "localhost"),
                getConfig().getInt("storage.mysql.port", 3306),
                getConfig().getString("storage.mysql.database", "beastwithdraw"),
                getConfig().getString("storage.mysql.username", "root"),
                getConfig().getString("storage.mysql.password", ""),
                getConfig().getBoolean("storage.mysql.use-ssl", false), getLogger());
    }

    private void registerPlaceholderExpansion() {
        try {
            Class<?> expansionType = Class.forName("dev.kodari.beastwithdraw.placeholder.WithdrawExpansion", true,
                    getClass().getClassLoader());
            Object expansion = expansionType.getConstructor(WithdrawPlugin.class).newInstance(this);
            expansionType.getMethod("register").invoke(expansion);
        } catch (ReflectiveOperationException | LinkageError exception) {
            getLogger().warning("PlaceholderAPI was detected but the withdraw expansion could not be registered: "
                    + exception.getMessage());
        }
    }

    private void selectEconomy() {
        economyProvider = EconomyProviders.select(this).orElse(null);
        if (noteManager != null && economyProvider != null) {
            noteManager.refreshNoteMaterial();
        }
    }

    public EconomyProvider economy() {
        return economyProvider;
    }

    public NoteStorage storage() {
        return storage;
    }

    public WithdrawNoteManager notes() {
        return noteManager;
    }

    public NamespacedKey noteIdKey() {
        return noteIdKey;
    }

    public NamespacedKey amountKey() {
        return amountKey;
    }

    public NamespacedKey currencyKey() {
        return currencyKey;
    }

    public NamespacedKey ownerKey() {
        return ownerKey;
    }

    public NamespacedKey createdKey() {
        return createdKey;
    }

    public NamespacedKey versionKey() {
        return versionKey;
    }

    public String pluginVersion() {
        return getDescription().getVersion();
    }

    public Optional<BigDecimal> parseAmount(String input) {
        if (input == null || !input.matches("[0-9]+(?:\\.[0-9]+)?")) {
            return Optional.empty();
        }
        try {
            BigDecimal amount = new BigDecimal(input);
            if (amount.signum() <= 0 || !Double.isFinite(amount.doubleValue())) {
                return Optional.empty();
            }
            if (economyProvider != null) {
                int precision = economyProvider.getFractionalDigits();
                if (precision >= 0 && amount.stripTrailingZeros().scale() > precision) {
                    return Optional.empty();
                }
            }
            return Optional.of(amount.stripTrailingZeros());
        } catch (NumberFormatException exception) {
            return Optional.empty();
        }
    }

    public boolean isWithinWithdrawalLimits(BigDecimal amount) {
        BigDecimal minimum = BigDecimal.valueOf(getConfig().getDouble("withdraw.minimum", 1.0));
        BigDecimal maximum = BigDecimal.valueOf(getConfig().getDouble("withdraw.maximum", 1_000_000_000.0));
        return amount.compareTo(minimum) >= 0 && amount.compareTo(maximum) <= 0;
    }

    public String formatAmount(BigDecimal amount) {
        return amount.stripTrailingZeros().toPlainString();