trtxtrn

Can you make me a plugin that gives ranks or coins to the person which redeems them? It needs to generate random codes that i can give to my clients. I use luckyperms

Kodari AI
KodariAug 1 at 11:29 pm 1
RedeemCodes
A Minecraft plugin that generates secure, single-use redemption codes for distributing LuckPerms ranks and configurable coin rewards. Administrators can create individual or bulk codes, view their status, and reload stored data. Players redeem codes through a simple command, automatically receiving the configured permission group or coin command reward. Codes persist across restarts in a dedicated YAML data file, with configurable messages, code length, reward commands, permissions, and validation limits.
trtxtrn

How do i generate a code and what it does

Kodari AI
KodariAug 1 at 11:37 pm 1

Generate a rank code

You need the redeemcodes.admin permission, which operators have by default.

Plain Text
/redeemcode generate rank VIP

This generates one random code, for example:

Plain Text
AB7KQ2MNPX4C

Give that code to your client. They redeem it with:

Plain Text
/redeemcode redeem AB7KQ2MNPX4C

The plugin then adds this LuckPerms group to their account:

Plain Text
group.VIP

The VIP group must already exist in LuckPerms. For example:

Plain Text
/lp creategroup VIP

Generate a coin code

For example, to generate a code worth 500 coins:

Plain Text
/redeemcode generate coins 500

The client redeems it using:

Plain Text
/redeemcode redeem CODE_HERE

The plugin runs the configured console command:

YAML
rewards:
  coins-command: "eco give %player% %amount%"

So it effectively runs:

Plain Text
eco give PlayerName 500

Make sure your economy plugin supports the eco give command. If your coins plugin uses a different command, change it in config.yml. For example:

YAML
rewards:
  coins-command: "coins give %player% %amount%"

Generate multiple codes at once

The last number controls how many separate codes are generated.

Generate 10 VIP codes:

Plain Text
/redeemcode generate rank VIP 10

Generate 25 codes worth 1,000 coins each:

Plain Text
/redeemcode generate coins 1000 25

Each code is unique and has the same reward.


Other commands

View all generated codes and their status:

Plain Text
/redeemcode list

Reload the configuration and saved codes:

Plain Text
/redeemcode reload

The codes are saved in:

Plain Text
plugins/RedeemCodes/data.yml

Each code can only be redeemed once. After successful redemption, it is marked as redeemed and cannot be used again.

trtxtrn

Can you make it so it actually shows all commands and doesnt just ghost it? like it shows suggestions. Also add a folder in which all codes are written Knight: KCC87A6EFG72 KCC87A6EFG23 etc. 1000 coins: KCC87A6EFG1D KCC87A6EFG7s

Kodari AI
KodariAug 1 at 11:50 pm 2
  1. Add visible command help and tab-completion suggestions for subcommands, reward types, and arguments.

  2. Export generated codes into a readable codes/ folder grouped by reward, while preserving the existing data storage.

Implemented:

  • /redeemcode help now displays all available commands.

  • Pressing Tab provides suggestions for:

    • help

    • redeem

    • generate

    • rank

    • coins

    • list

    • reload

  • Generated codes are exported into:

Plain Text
plugins/RedeemCodes/codes/

Example files:

Plain Text
codes/rank-Knight.txt
codes/coins-1000.txt

Example contents:

Plain Text
Knight: KCC87A6EFG72
Knight: KCC87A6EFG23
Plain Text
1000 coins: KCC87A6EFG1D
1000 coins: KCC87A6EFG7S

Generate them with:

Plain Text
/redeemcode generate rank Knight 10

or:

Plain Text
/redeemcode generate coins 1000 10

The plugin will also tell you in-game that the codes were saved in the codes folder.

trtxtrn

Wheres the new file?

Kodari AI
KodariAug 1 at 11:52 pm 1

The generated code files are created on the Minecraft server, not in the source project.

After generating codes, find them here:

Plain Text
/plugins/RedeemCodes/codes/

Examples:

Plain Text
plugins/RedeemCodes/codes/rank-Knight.txt
plugins/RedeemCodes/codes/coins-1000.txt

Generate them with:

Plain Text
/redeemcode generate rank Knight 10
/redeemcode generate coins 1000 10

If the codes folder does not exist yet, generate at least one code first. The plugin creates the folder and file automatically.

trtxtrn

where can i get the new link to download the new redeemcodes version

Kodari AI
KodariAug 1 at 11:56 pm 1

There isn’t currently a public download link—the updated RedeemCodes plugin exists only in this project workspace. I can’t provide a fake URL.

To obtain it, download/export the project files from this chat interface, then build the plugin into a .jar. The finished JAR should be placed in:

Plain Text
plugins/

If your interface provides a Download project or Export files button, use that. Otherwise, I can prepare the complete project as a ZIP-ready set of files for you to download.

trtxtrn

Make it so we can set a time for the rank, example: 1d,3d,7d,30d,perm etc.

Kodari AI
KodariAug 6 at 2:25 pm 1
  1. Add rank duration syntax: /redeemcode generate rank <rank> <1d|3d|7d|30d|perm> [amount].

  2. Store the duration with each code so it survives restarts and appears in exported code files.

  3. Apply temporary LuckPerms groups with an expiry, while perm creates a permanent group node.

  4. Update help, usage, tab suggestions, and list output.

Rank durations are now supported.

Use:

Plain Text
/redeemcode generate rank Knight 1d
/redeemcode generate rank Knight 3d
/redeemcode generate rank Knight 7d
/redeemcode generate rank Knight 30d
/redeemcode generate rank Knight perm

To generate multiple codes:

Plain Text
/redeemcode generate rank Knight 7d 10

This creates 10 separate codes. When redeemed, each code gives the player the Knight LuckPerms group for 7 days.

perm gives the group permanently.

Temporary ranks are applied through LuckPerms and remain saved across server restarts. The duration is also stored in data.yml and shown in the exported files, for example:

Plain Text
plugins/RedeemCodes/codes/rank-Knight-7d.txt

Example contents:

Plain Text
Knight (7d): KCC87A6EFG72
Knight (7d): KCC87A6EFG23

Tab suggestions now show:

Plain Text
1d
3d
7d
30d
perm

Coins continue to work as before:

Plain Text
/redeemcode generate coins 1000 10
trtxtrn

it says the amount must be a positive whole number

Kodari AI
KodariAug 6 at 3:01 pm 1
  1. Fix rank-code parsing so 1d, 3d, 7d, 30d, and perm are recognized as durations instead of being treated as code amounts.

  2. Preserve the older rank syntax by allowing /redeemcode generate rank Knight 10 to create 10 permanent codes.

  3. Also accept the alternate order /redeemcode generate rank Knight 10 7d.

Fixed. Rank code generation now accepts:

Plain Text
/redeemcode generate rank Knight 1d
/redeemcode generate rank Knight 3d
/redeemcode generate rank Knight 7d
/redeemcode generate rank Knight 30d
/redeemcode generate rank Knight perm

To generate multiple codes, use either format:

Plain Text
/redeemcode generate rank Knight 7d 10

or:

Plain Text
/redeemcode generate rank Knight 10 7d

The second format also fixes the error you received. For permanent codes:

Plain Text
/redeemcode generate rank Knight 10 perm

The older command remains supported:

Plain Text
/redeemcode generate rank Knight 10

That creates 10 permanent Knight codes.

trtxtrn

Make the option for it to support seconds,minutes,hours,days,months,years and perm. Make a way to delete a certain code and every code for a specific rank.

Kodari AI
KodariAug 6 at 3:07 pm 1
  1. Expand rank-duration parsing to support seconds, minutes, hours, days, months, years, and perm.

  2. Add commands to delete one code or every unredeemed code for a specific rank, including help text, permissions, tab suggestions, persistence, and exported files.

Implemented.

Supported rank durations

You can now use:

Plain Text
10s       seconds
10m       minutes
2h        hours
7d        days
2mo       months
1y        years
perm      permanent

Full unit names also work:

Plain Text
10seconds
15minutes
2hours
7days
3months
1year

Examples:

Plain Text
/redeemcode generate rank Knight 30m
/redeemcode generate rank Knight 7d 10
/redeemcode generate rank Knight 2months
/redeemcode generate rank Knight perm

Months are treated as 30 days, and years as 365 days.

Delete one code

Plain Text
/redeemcode delete KCC87A6EFG72

Delete every code for a rank

Plain Text
/redeemcode delete rank Knight

This removes all generated Knight codes, including already-redeemed codes, except codes currently being processed. The data.yml file and exported files in:

Plain Text
plugins/RedeemCodes/codes/

are updated automatically.

Tab-completion and /redeemcode help now include the new duration and deletion commands.

trtxtrn

in the folder write the info about - status, created by, claimed by. Make it so i can remove codes for a specific rank

Kodari AI
KodariAug 6 at 3:14 pm 1
  1. Add status, created by, and claimed by details to each exported code entry.

  2. Add and verify a rank-wide removal command that deletes all codes belonging to a selected rank and refreshes the exported files.

Updated.

The files in plugins/RedeemCodes/codes/ now include:

Plain Text
Code: KCC87A6EFG72
Status: Available
Created by: AdminName
Claimed by: Not claimed

After redemption:

Plain Text
Code: KCC87A6EFG72
Status: Redeemed
Created by: AdminName
Claimed by: PlayerName

The information is also saved in data.yml and survives restarts.

To remove every code for a specific rank:

Plain Text
/redeemcode delete rank Knight

This removes all Knight codes, saves the changes, and updates the exported files in:

Plain Text
plugins/RedeemCodes/codes/

To remove one specific code:

Plain Text
/redeemcode delete KCC87A6EFG72
trtxtrn

Can you make a custom coins system. Coins can only be obtained thru codes. Make a coinshop and let me edit the INVENTORY GUI easily

Kodari AI
KodariAug 6 at 3:30 pm 2
  1. Add a persistent custom coin balance earned only by redeeming coin codes.

  2. Add an editable inventory-based coin shop with configurable items, prices, commands, and GUI text.

  3. Add shop commands/permissions, redemption balance updates, persistence, and tab suggestions without changing the existing rank-code flow.

Implemented a custom coin system and configurable coin shop.

Custom coins

  • Coins are stored per-player in:

Plain Text
plugins/RedeemCodes/coins.yml
  • Coins can only be added through redeemed coin codes.

  • Coin balances survive restarts.

  • Check your balance with:

Plain Text
/redeemcode coins
/redeemcode balance

Coin shop

Open it with:

Plain Text
/coinshop

or:

Plain Text
/redeemcode shop

Purchases use the internal coin balance and run configurable console commands.

Edit the GUI

Edit this section in:

Plain Text
plugins/RedeemCodes/config.yml
YAML
coin-shop:
  title: "&8Coin Shop &7(%balance% coins)"
  size: 27
  items:
    diamond:
      slot: 11
      material: DIAMOND
      amount: 1
      name: "&bDiamond"
      lore:
        - "&7Price: &e%price% coins"
        - "&7Your balance: &e%balance% coins"
        - ""
        - "&aClick to purchase"
      price: 100
      commands:
        - "give %player% diamond 1"

You can change:

  • GUI title

  • GUI size

  • Item slot

  • Material

  • Item amount

  • Display name

  • Lore

  • Price

  • Commands executed after purchase

Available placeholders:

Plain Text
%player%
%uuid%
%price%
%balance%

After changing the configuration, run:

Plain Text
/redeemcode reload
trtxtrn

return it to the previous. Also i want the coins to be added to the plugin i have installed the placeholder is %coinvaultshop_coins% lmk if u need any more info

Kodari AI
KodariAug 6 at 4:14 pm 1
  1. Remove the custom coin storage/shop changes and restore the previous redeem-code behavior.

  2. Make coin-code rewards deposit into the installed CoinVaultShop balance, using %coinvaultshop_coins% only for balance display/checking.

The placeholder %coinvaultshop_coins% can read a player’s balance, but it cannot add coins. I need one of these from CoinVaultShop:

  • The command for giving coins, for example:

    Plain Text
    /coinvaultshop give <player> <amount>
    
  • Or its developer/API documentation.

  • Also confirm whether PlaceholderAPI is installed.

I’ll then remove the custom /coinshop, coins.yml, and internal coin balance system, restore the previous plugin behavior, and make redeemed coin codes execute the correct CoinVaultShop coin-give command.

trtxtrn

/coinadmin give <player> <amount>

Kodari AI
KodariAug 6 at 4:25 pm 1
  1. Remove the custom coins.yml, /coinshop, and internal coin-balance/shop code.

  2. Change coin-code redemption to execute coinadmin give <player> <amount> from the console.

  3. Restore command help, tab completion, configuration, and plugin.yml to the redeem-code-only behavior.

Coin codes now use CoinVaultShop directly:

Plain Text
coinadmin give <player> <amount>

Changes made:

  • Removed the custom internal coin balance system.

  • Removed /coinshop and /redeemcode shop.

  • Removed the custom shop GUI/configuration.

  • Coin codes now execute the CoinVaultShop command through the console.

  • Existing rank durations, code deletion, status, creator, and claimant information remain unchanged.

  • CoinVaultShop remains responsible for balances and %coinvaultshop_coins%.

Redeeming a 500-coin code now runs:

Plain Text
coinadmin give PlayerName 500

After updating the plugin, you may delete the old file manually:

Plain Text
plugins/RedeemCodes/coins.yml

It is no longer used.

trtxtrn

Okay new command is /coins give player amount. I want knight rank to receive 500 coins, emperor 4000 coins, duke 3000 coins, earl 2000 coins, squire 1000 coins and page 500 coins. I want knight to receive /shards booster user 720 1 . I want you to make it so people can receive anything thru codes (kits, items, money, crate keys, shards etc). Tell me if you need information on anything

Kodari AI
KodariAug 10 at 9:32 pm 2
  1. Update coin-code redemption to use /coins give <player> <amount>.

  2. Configure rank codes with the requested coin and shard rewards.

  3. Extend codes to support configurable command-based rewards for kits, items, money, crate keys, shards, and other server commands.

The requested rank rewards are configured, and generic command rewards are supported through config.yml. I’m tightening the help text and exported file labels so command-code files are accurate and the new syntax is discoverable.

Implemented:

  • Coin rewards now use:

    Plain Text
    /coins give <player> <amount>
    
  • Rank rewards:

    • Knight: 500 coins + /shards booster <player> 720 1

    • Emperor: 4,000 coins

    • Duke: 3,000 coins

    • Earl: 2,000 coins

    • Squire: 1,000 coins

    • Page: 500 coins

Generic command rewards are also supported. Configure them in config.yml:

YAML
command-rewards:
  starter-kit:
    - "kit give %player% starter"

  crate-key:
    - "crate key give %player% vote 1"

  money:
    - "eco give %player% 1000"

Then generate codes with:

Plain Text
/redeemcode generate command starter-kit 10
/redeemcode generate command crate-key 10
/redeemcode generate command money 10

Supported placeholders:

Plain Text
%player%
%uuid%
%value%
%rank%
%code%

You can add multiple commands to one reward:

YAML
command-rewards:
  emperor-bundle:
    - "coins give %player% 4000"
    - "crate key give %player% legendary 3"
    - "kit give %player% emperor"

The Knight shard command is currently configured as:

YAML
- "shards booster %player% 720 1"

I need the exact command syntax for your kit, item, money, crate-key, and shard plugins if those examples differ. Also confirm whether user in /shards booster user 720 1 is a literal argument or represents the player name.

trtxtrn

Kits: /kit give &6&lEmperor user /kit give &c&lDuke user /kit give &e&lEarl user /kit give &a&lSquire user /kit give &5&lPage user

Crate keys: /crate giveKey alchemist_key user /crate giveKey blacksmiths_key user /crate giveKey dungeon_key user /crate giveKey knights_key user /crate giveKey monthly_key user

Money: /eco give user amount

Shards: /shards give user amount

Item: /give user item amount

User means the name of the player redeeming the key Item means the item Amount means the amount of the thing (32/64/128 etc)

Kodari AI
KodariAug 10 at 9:44 pm 1
  1. Add configurable command rewards for kits, crate keys, money, shards, and items.

  2. Support player, item, amount, and generic argument placeholders, with per-code arguments such as money:1000 or item:DIAMOND:64.

  3. Preserve the existing rank rewards and single-use code behavior.

Implemented the reward commands and placeholders.

Configured rewards

Kits

Plain Text
emperor-kit → /kit give &6&lEmperor <player>
duke-kit    → /kit give &c&lDuke <player>
earl-kit    → /kit give &e&lEarl <player>
squire-kit  → /kit give &a&lSquire <player>
page-kit    → /kit give &5&lPage <player>

Generate kit codes with:

Plain Text
/redeemcode generate command emperor-kit 10

Crate keys

Plain Text
alchemist-key   → alchemist_key
blacksmiths-key → blacksmiths_key
dungeon-key     → dungeon_key
knights-key     → knights_key
monthly-key     → monthly_key

Example:

Plain Text
/redeemcode generate command crate-key:alchemist_key 10

Money

Plain Text
/redeemcode generate command money:1000 10

Runs:

Plain Text
/eco give PlayerName 1000

Shards

Plain Text
/redeemcode generate command shards:250 10

Runs:

Plain Text
/shards give PlayerName 250

Items

Plain Text
/redeemcode generate command item:DIAMOND:64 10

Runs:

Plain Text
/give PlayerName DIAMOND 64

The final number is the code batch amount. For example, 10 creates 10 separate codes.

Generic command rewards

Additional rewards can be added under command-rewards in config.yml. Supported placeholders include:

Plain Text
%player%   Player name
%user%     Player name
%uuid%     Player UUID
%item%     First reward argument
%amount%   Last reward argument
%argument1%, %argument2%, etc.
%code%     Redeemed code

All configured commands execute from the console, and codes remain single-use.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 996
src/main/java/com/kodari/redeemcodes/RedeemCodesPlugin.java
package com.kodari.redeemcodes;

import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import net.luckperms.api.node.Node;
import net.luckperms.api.node.types.InheritanceNode;
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.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class RedeemCodesPlugin extends JavaPlugin implements CommandExecutor, TabCompleter {
    private static final Pattern VALID_RANK = Pattern.compile("[A-Za-z0-9_-]+");

    private CodeManager codeManager;
    private LuckPerms luckPerms;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        luckPerms = LuckPermsProvider.get();
        codeManager = new CodeManager(this);
        codeManager.load();

        getCommand("redeemcode").setExecutor(this);
        getCommand("redeemcode").setTabCompleter(this);
    }

    @Override
    public void onDisable() {
        if (codeManager != null) {
            codeManager.save();
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 0) {
            help(sender);
            return true;
        }

        String subcommand = args[0].toLowerCase(Locale.ROOT);

        if (subcommand.equals("help")) {
            help(sender);
            return true;
        }

        if (subcommand.equals("redeem")) {
            redeem(sender, args);
            return true;
        }

        if (subcommand.equals("generate")) {
            generate(sender, args);
            return true;
        }

        if (subcommand.equals("list")) {
            list(sender);
            return true;
        }

        if (subcommand.equals("reload")) {
            reload(sender);
            return true;
        }

        if (subcommand.equals("delete")) {
            delete(sender, args);
            return true;
        }

        send(sender, "unknown-command");
        return true;
    }

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        List<String> suggestions = new ArrayList<>();

        if (args.length == 1) {
            suggestions.add("help");
            suggestions.add("redeem");

            if (sender.hasPermission("redeemcodes.admin")) {
                suggestions.add("generate");
                suggestions.add("list");
                suggestions.add("reload");
                suggestions.add("delete");
            }
        } else if (args.length == 2 && args[0].equalsIgnoreCase("generate")
                && sender.hasPermission("redeemcodes.admin")) {
            suggestions.add("rank");
            suggestions.add("coins");
            suggestions.add("command");
        } else if (args.length == 3 && args[0].equalsIgnoreCase("generate")
                && args[1].equalsIgnoreCase("command") && sender.hasPermission("redeemcodes.admin")) {
            suggestions.addAll(getConfig().getConfigurationSection("command-rewards") == null
                    ? Collections.emptyList()
                    : getConfig().getConfigurationSection("command-rewards").getKeys(false));
        } else if (args.length == 2 && args[0].equalsIgnoreCase("redeem")
                && sender.hasPermission("redeemcodes.admin")) {
            for (RedeemCode redeemCode : codeManager.getCodes()) {
                if (!redeemCode.isRedeemed()) {
                    suggestions.add(redeemCode.getCode());
                }
            }
        } else if (args.length == 2 && args[0].equalsIgnoreCase("delete")
                && sender.hasPermission("redeemcodes.admin")) {
            suggestions.add("rank");
            for (RedeemCode redeemCode : codeManager.getCodes()) {
                suggestions.add(redeemCode.getCode());
            }
        } else if (args.length == 3 && args[0].equalsIgnoreCase("delete")
                && args[1].equalsIgnoreCase("rank") && sender.hasPermission("redeemcodes.admin")) {
            for (RedeemCode redeemCode : codeManager.getCodes()) {
                if (redeemCode.getType() == RewardType.RANK) {
                    suggestions.add(redeemCode.getValue());
                }
            }
        } else if ((args.length == 4 || args.length == 5) && args[0].equalsIgnoreCase("generate")
                && args[1].equalsIgnoreCase("rank") && sender.hasPermission("redeemcodes.admin")) {
            suggestions.addAll(Arrays.asList("1s", "1m", "1h", "1d", "1mo", "1y"));
            suggestions.add("perm");
        }

        String input = args[args.length - 1].toLowerCase(Locale.ROOT);
        suggestions.removeIf(suggestion -> !suggestion.toLowerCase(Locale.ROOT).startsWith(input));
        return suggestions;
    }

    private void help(CommandSender sender) {
        send(sender, "help-header");
        send(sender, "help-redeem");
        if (sender.hasPermission("redeemcodes.admin")) {
            send(sender, "help-generate");
            send(sender, "help-list");
            send(sender, "help-reload");
            send(sender, "help-delete");
        }
    }

    private void redeem(CommandSender sender, String[] args) {
        if (!(sender instanceof Player)) {
            send(sender, "player-only");
            return;
        }

        if (args.length < 2) {
            send(sender, "usage");
            return;
        }

        Player player = (Player) sender;
        RedeemCode redeemCode = codeManager.beginRedemption(args[1]);

        if (redeemCode == null) {
            if (codeManager.isPending(args[1])) {
                send(player, "code-processing");
            } else {
                send(player, "invalid-code");
            }
            return;
        }

        if (redeemCode.getType() == RewardType.RANK) {
            redeemRank(player, redeemCode);
        } else if (redeemCode.getType() == RewardType.COINS) {
            redeemCoins(player, redeemCode);
        } else {
            redeemCommand(player, redeemCode);
        }
    }

    private void redeemRank(Player player, RedeemCode redeemCode) {
        UUID playerId = player.getUniqueId();
        String group = redeemCode.getValue();
        String duration = redeemCode.getDuration();

        luckPerms.getUserManager().modifyUser(playerId, user -> {
            if (duration.equalsIgnoreCase("perm")) {
                user.data().add(InheritanceNode.builder(group).build());
            } else {