errorx.net

FxBounty

Author: Fenix Studio

Create a fully functional, lightweight and optimized Minecraft Bounty plugin.

Platform: Paper 1.21+ Economy: Vault Storage: YAML / SQLite

  1. Prefix

prefix: "&#FF541A&lBOUNTY &8▶&r"

  1. Commands

Player Commands

/bounty /bounty set <player> <amount> /bounty remove <player> /bounty check <player> /bounty toggle /bounty top /bounty help

Admin Commands

/bounty reload /bounty admin remove <player> /bounty admin set <player> <amount> /bounty admin clear /bounty admin claim <player> /bounty admin reset <player>

Additional

/fxbounty

All commands must support tab completion.

  1. Bounty System
  • Players can set bounties on other players.
  • Use Vault economy.
  • Multiple players can contribute to one target's bounty.
  • Track each contributor separately.
  • Display the combined bounty amount.
  • When someone kills a player with an active bounty, the killer receives the total bounty.
  • Remove the claimed bounty automatically.
  • Players cannot claim their own bounty.
  • Prevent self-bounties and duplicate claims.
  • Save all data permanently.
  • Support offline players when setting and checking bounties.
  1. Amount Configuration

minimum-amount: 1000 maximum-amount: 10000000

format: true

format-in: - K - M - B - T

Support automatic number formatting.

Examples:

  • 1,000 = 1K
  • 10,000 = 10K
  • 1,000,000 = 1M
  1. Per-Player Bounty Limit

per-player-bounty-limit: enabled: true default: 3 max-limit: 99

  • Default limit: 3 different bounty targets.
  • Maximum limit: 99.
  • Support custom limits through "fxbounty.limit.<1-99>".
  • Additional contributions to an existing target must not consume another target slot.
  1. Broadcasts

broadcast: bounty-add: enabled: true chat: true actionbar: false message: - "%prefix% &#FF541A%player% &fhas set a bounty on &#FF541A%target% &fof &#FF541A%amount%"

bounty-claim: enabled: true chat: true actionbar: false message: - "%prefix% &#FF541A%player% &fhas claimed a bounty from &#FF541A%target% &fand received &#FF541A%amount%"

Chat and actionbar must work independently.

  1. Main Bounty GUI

Default size: 54 slots.

Fill Item

fill-item: enabled: true material: BLACK_STAINED_GLASS_PANE slots: [0-9, 17-18, 26-27, 35-36, 44] display_name: " " lore: []

When enabled, bounty heads automatically occupy available middle slots.

When disabled, bounty heads occupy slots 0-44.

Navigation items must never overlap bounty heads.

Bounty Head

bounty-item: material: PLAYER_HEAD display_name: "&#FFD800%player%'s bounty" lore: - "&7Bounty" - "" - "&#FF541A● &fPlayer: &#FF541A%player%" - "&#FF541A● &fAmount: &#FF541A%amount%" - "&#FF541A● &fSet By: &#FF541A%bounty_admin%" - "" - "&#FFD800▶ &l&nCLICK&r &#FFD800for Details!"

  • Display the actual player head.
  • Show player name, total bounty and contributors.
  • Clicking a head sends the bounty-detail message.
  • Automatically refresh updated bounty information.
  1. Navigation Items

Previous Page

previous-page: material: RED_STAINED_GLASS_PANE slot: 48 display_name: "&#FF2E2E&lPREVIOUS PAGE" lore: - "&7Bounty" - "" - "&#FFD800▶&l&nCLICK&r &#FFD800to Go"

Refresh

refresh: material: RECOVERY_COMPASS slot: 49 display_name: "&#FFB00E&lREFRESH PAGE" lore: - "&7Bounty" - "" - "&#FFD800▶&l&nCLICK&r &#FFD800to Refresh"

Next Page

next-page: material: LIME_STAINED_GLASS_PANE slot: 50 display_name: "&#69F43F&lNEXT PAGE" lore: - "&7Bounty" - "" - "&#FFD800▶&l&nCLICK&r &#FFD800to Go"

My Bounties

my-bounties: material: BARREL slot: 45 display_name: "&#8D12FF&lMY BOUNTIES" lore: - "&7Bounty" - "" - "&#FFD800▶&l&nCLICK&r &#FFD800to Go"

  1. Bounty Filter

bounty-filter: material: CHEST_MINECART slot: 46 display_name: "&#EF4B25&lBOUNTY FILTER"

Four sorting modes:

Latest to Oldest (Default)

lore: - "&7Sorting" - "" - "&#EF4B25Selection:" - "&8● &#EF4B25Latest to Oldest" - "&8▶ &7Oldest to Latest" - "&8▶ &7Highest to Lowest" - "&8▶ &7Lowest to Highest" - "" - "&#FFD800▶&l&nCLICK&r &#FFD800to Sort"

Oldest to Latest

lore: - "&7Sorting" - "" - "&#EF4B25Selection:" - "&8▶ &7Latest to Oldest" - "&8● &#EF4B25Oldest to Latest" - "&8▶ &7Highest to Lowest" - "&8▶ &7Lowest to Highest" - "" - "&#FFD800▶&l&nCLICK&r &#FFD800to Sort"

Highest to Lowest

lore: - "&7Sorting" - "" - "&#EF4B25Selection:" - "&8▶ &7Latest to Oldest" - "&8▶ &7Oldest to Latest" - "&8● &#EF4B25Highest to Lowest" - "&8▶ &7Lowest to Highest" - "" - "&#FFD800▶&l&nCLICK&r &#FFD800to Sort"

Lowest to Highest

lore: - "&7Sorting" - "" - "&#EF4B25Selection:" - "&8▶ &7Latest to Oldest" - "&8▶ &7Oldest to Latest" - "&8▶ &7Highest to Lowest" - "&8● &#EF4B25Lowest to Highest" - "" - "&#FFD800▶&l&nCLICK&r &#FFD800to Sort"

Requirements:

  • Clicking cycles through sorting modes.
  • Selected mode displays ●.
  • Other modes display ▶.
  • Sorting works across all pages.
  • Refresh preserves the selected sorting mode.
  1. My Bounties GUI

Display all bounties placed by the player.

bounty-item: material: PLAYER_HEAD display_name: "&#FFD800%player%'s bounty" lore: - "&7Bounty" - "" - "&#FF541A● &fPlayer: &#FF541A%player%" - "&#FF541A● &fYour Amount: &#FF541A%amount%" - "" - "&#FFD800▶ &l&nCLICK&r &#FFD800to Remove"

Requirements:

  • Display only the player's contributions.
  • Clicking a head removes their own contribution.
  • Refund the corresponding amount.
  • Never remove other contributors' money.
  • Delete the target's bounty if no contributions remain.
  • Refresh GUI automatically.
  • Include pagination and sorting.
  1. Top Bounty GUI

Create a leaderboard GUI showing:

  • Highest bounty targets.
  • Actual player heads.
  • Player names.
  • Total bounty amounts.
  • Ranking positions.

Sort from highest bounty to lowest.

  1. Messages

messages:

bounty-add-broadcast: "%prefix% &#FF541A%player% &fhas set a Bounty on &#FF541A%target% &fof &#FF541A%amount%"

bounty-add: "%prefix% &fYou have successfully set a Bounty on &#FF541A%player%"

bounty-remove: "%prefix% &fYou have successfully removed the bounty from &#FF541A%player%"

bounty-claim: "%prefix% &fYou have successfully claimed the bounty from &#FF541A%player% &fof &#FF541A%amount%"

bounty-check: "%prefix% &fThis player has a bounty of &#FF541A%amount%"

bounty-detail: "%prefix% &fThis player's bounty amount is &#FF541A%amount%"

reload: "%prefix% &fConfiguration has successfully reloaded!"

no-bounty: "%prefix% &fThis player doesn't have an active bounty."

insufficient-balance: "%prefix% &fYou don't have enough money!"

self-bounty: "%prefix% &fYou cannot place a bounty on yourself!"

invalid-amount: "%prefix% &fPlease enter a valid amount."

bounty-minimum: "%prefix% &fMinimum bounty amount is &#FF541A%amount%"

bounty-maximum: "%prefix% &fMaximum bounty amount is &#FF541A%amount%"

bounty-limit: "%prefix% &fYou have reached your bounty limit!"

bounty-claimed: "%prefix% &fThis bounty has already been claimed."

bounty-empty: "%prefix% &fYou haven't placed any bounties."

no-permission: "%prefix% &cYou don't have permission to use this command."

player-not-found: "%prefix% &fPlayer not found."

toggle-enabled: "%prefix% &fBounty notifications enabled."

toggle-disabled: "%prefix% &fBounty notifications disabled."

admin-remove: "%prefix% &fSuccessfully removed &#FF541A%player%'s bounty."

admin-set: "%prefix% &fSuccessfully set a bounty on &#FF541A%player% &fof &#FF541A%amount%"

admin-clear: "%prefix% &fAll active bounties have been cleared."

admin-reset: "%prefix% &fSuccessfully reset &#FF541A%player%'s bounty data."

  1. Sounds

sounds: enabled: true

gui-click-sound: enabled: true sound: UI_BUTTON_CLICK volume: 1.0 pitch: 1.0

bounty-claimed: enabled: true sound: UI_TOAST_CHALLENGE_COMPLETE volume: 1.0 pitch: 1.0

bounty-added: enabled: true sound: ENTITY_EXPERIENCE_ORB_PICKUP volume: 1.0 pitch: 1.0

bounty-removed: enabled: true sound: ENTITY_ITEM_BREAK volume: 1.0 pitch: 1.0

Every sound must be independently configurable.

  1. Permissions

permissions: fxbounty.add: true fxbounty.remove: true fxbounty.check: true fxbounty.limit.<1-99>: false fxbounty.admin: op

  • "fxbounty.add": Place bounties.
  • "fxbounty.remove": Remove personal contributions.
  • "fxbounty.check": Check bounty amounts.
  • "fxbounty.limit.<1-99>": Custom bounty limits.
  • "fxbounty.admin": Access all admin commands.
  1. Configuration Structure

IMPORTANT: The entire plugin must use ONLY ONE configuration file: "config.yml".

plugins/ └── FxBounty/ ├── config.yml └── data/ └── bounties.db

Everything must be configurable inside "config.yml", including:

  • Prefix
  • Commands settings
  • Minimum and maximum amounts
  • Number formatting
  • Bounty limits
  • Broadcasts
  • GUI titles and sizes
  • Fill items
  • Bounty heads
  • Navigation items
  • Sorting modes
  • My Bounties GUI
  • Top Bounty GUI
  • Messages
  • Sounds
  • Permissions
  • Storage settings
  • Anti-abuse settings

Do not generate separate messages.yml, gui.yml or sounds.yml files.

  1. Technical Requirements
  • UUID-based player identification.
  • Vault economy integration.
  • Paper 1.21+ compatibility.
  • YAML or SQLite storage.
  • Persistent bounty data.
  • Async database operations where appropriate.
  • Safe economy transactions.
  • Prevent item duplication.
  • Protect all GUIs from inventory stealing.
  • Correct pagination and sorting.
  • Configurable GUI titles and sizes.
  • Hex color support.
  • Tab completion.
  • Proper permission checks.
  • Reload without restarting.
  • Handle disconnects and server restarts safely.
  • Prevent duplicate claims during simultaneous kill events.
  • Lightweight event handling.
  1. Final Plugin Information

plugin: name: FxBounty author: Fenix Studio main-command: /bounty admin-command: /fxbounty economy: Vault platform: Paper 1.21+ configuration: config.yml ONLY performance: Lightweight and optimized

FINAL INSTRUCTIONS:

Create a complete, production-ready FxBounty plugin.

Every command, GUI, sorting mode, permission, message, sound, broadcast and bounty mechanic must work correctly.

No placeholder functionality, no compilation errors and no major bugs.

Keep the code clean, modular and optimized.

Made by Fenix Studio.

Kodari AI
KodariNov 12 at 3:57 am 6
FxBounty
A comprehensive Minecraft bounty plugin for Paper 1.21+ with Vault economy integration. Players can set bounties on other players, contribute to existing bounties, and claim rewards from kills. Features a full GUI system with pagination, sorting modes, player head display, and navigation items. Includes per-player bounty limits, offline player support, SQLite/YAML storage, configurable broadcasts, sounds, and messages. Admin commands for complete bounty management, automatic number formatting, and anti-abuse protections against self-bounties and duplicate claims.

Created FxBounty with Vault integration, bounty commands, paginated GUIs, sorting, notifications, and SQLite or YAML storage.

Important limitations: Storage changes require a restart and do not migrate existing data. Vault transactions and bounty storage cannot be committed atomically

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 762
src/main/java/com/fenixstudio/fxbounty/FxBounty.java
package com.fenixstudio.fxbounty;

import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FxBounty extends JavaPlugin implements Listener {
    public static final UUID ADMIN = new UUID(0, 0);
    public final Map<UUID, Bounty> bounties = new HashMap<>();
    public final Set<UUID> muted = new HashSet<>();
    public Economy economy;
    private Storage storage;
    public BountyMenu menu;
    private static final Pattern HEX = Pattern.compile("&#([A-Fa-f0-9]{6})");

    @Override public void onEnable() {
        saveDefaultConfig();
        RegisteredServiceProvider<Economy> provider = getServer().getServicesManager().getRegistration(Economy.class);
        if (provider == null || provider.getProvider() == null) {
            getLogger().severe("Vault economy provider not found.");
            getServer().getPluginManager().disablePlugin(this); return;
        }
        economy = provider.getProvider();
        try { storage = new Storage(this); storage.load(bounties, muted); }
        catch (Exception e) { getLogger().severe("Cannot load bounty storage: " + e); getServer().getPluginManager().disablePlugin(this); return; }
        menu = new BountyMenu(this);
        BountyCommand command = new BountyCommand(this);
        Objects.requireNonNull(getCommand("bounty")).setExecutor(command);
        Objects.requireNonNull(getCommand("bounty")).setTabCompleter(command);
        Objects.requireNonNull(getCommand("fxbounty")).setExecutor(command);
        Objects.requireNonNull(getCommand("fxbounty")).setTabCompleter(command);
        getServer().getPluginManager().registerEvents(this, this);
        getServer().getPluginManager().registerEvents(menu, this);
    }

    public boolean save() {
        try { storage.save(bounties, muted); return true; }
        catch (Exception e) { getLogger().severe("Unable to save bounties: " + e); return false; }
    }

    public String color(String input) {
        Matcher matcher = HEX.matcher(input == null ? "" : input);
        StringBuffer out = new StringBuffer();
        while (matcher.find()) matcher.appendReplacement(out, Matcher.quoteReplacement(net.md_5.bungee.api.ChatColor.of("#" + matcher.group(1)).toString()));
        matcher.appendTail(out);
        return ChatColor.translateAlternateColorCodes('&', out.toString());
    }

    public String text(String input, Map<String, String> vars) {
        String result = input == null ? "" : input;
        result = result.replace("%prefix%", getConfig().getString("prefix", ""));
        for (Map.Entry<String, String> entry : vars.entrySet()) result = result.replace("%" + entry.getKey() + "%", entry.getValue());
        return color(result);
    }

    public void message(CommandSender sender, String key, Map<String, String> vars) {
        sender.sendMessage(text(getConfig().getString("messages." + key, key), vars));
    }
    public void message(CommandSender sender, String key) { message(sender, key, Map.of()); }

    public String amount(double value) {
        if (!getConfig().getBoolean("format", true)) return new DecimalFormat("#,##0.##").format(value);
        List<String> suffixes = getConfig().getStringList("format-in");
        int i = -1;
        while (value >= 1000 && i + 1 < suffixes.size()) { value /= 1000; i++; }
        return new DecimalFormat("0.##").format(value) + (i < 0 ? "" : suffixes.get(i));
    }

    public String name(UUID id) {
        if (id.equals(ADMIN)) return "Admin";
        String name = Bukkit.getOfflinePlayer(id).getName();
        return name == null ? id.toString() : name;
    }

    public Map<String, String> vars(Bounty b, double amount) {
        return Map.of("player", name(b.target), "target", name(b.target), "amount", amount(amount), "bounty_admin", String.join(", ", b.contributions.keySet().stream().map(this::name).toList()));
    }

    public void sound(Player p, String key) {
        String path = "sounds." + key;
        if (getConfig().getBoolean("sounds.enabled", true) && getConfig().getBoolean(path + ".enabled", true)) {
            String sound = getConfig().getString(path + ".sound", "");
            p.playSound(p.getLocation(), sound.toLowerCase(Locale.ROOT).replace('_', '.'), (float) getConfig().getDouble(path + ".volume", 1), (float) getConfig().getDouble(path + ".pitch", 1));
        }
    }

    public void broadcast(String type, Player actor, Bounty bounty, double value) {
        String path = "broadcast." + type;
        if (!getConfig().getBoolean(path + ".enabled", true)) return;
        Map<String, String> vars = new HashMap<>(vars(bounty, value));
        vars.put("player", actor.getName());
        for (Player online : Bukkit.getOnlinePlayers()) {
            if (muted.contains(online.getUniqueId())) continue;
            for (String line : getConfig().getStringList(path + ".message")) {
                String message = text(line, vars);
                if (getConfig().getBoolean(path + ".chat", true)) online.sendMessage(message);
                if (getConfig().getBoolean(path + ".actionbar", false)) online.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
            }
        }
    }

    public boolean claim(Player killer, UUID target) {
        Bounty bounty = bounties.get(target);
        if (bounty == null || killer.getUniqueId().equals(target)) return false;
        double total = bounty.total();
        if (!economy.depositPlayer(killer, total).transactionSuccess()) { message(killer, "transaction-failed"); return false; }
        bounties.remove(target);
        if (!save()) {
            bounties.put(target, bounty);
            if (!economy.withdrawPlayer(killer, total).transactionSuccess()) getLogger().severe("CRITICAL: failed to reverse payout to " + killer.getUniqueId());
            message(killer, "storage-failed"); return false;
        }
        message(killer, "bounty-claim", vars(bounty, total));
        broadcast("bounty-claim", killer, bounty, total);
        sound(killer, "bounty-claimed"); menu.refreshAll();
        return true;
    }

    @EventHandler public void death(PlayerDeathEvent event) {
        Player killer = event.getEntity().getKiller();
        if (killer != null && bounties.containsKey(event.getEntity().getUniqueId())) claim(killer, event.getEntity().getUniqueId());
    }
}