bambuslawek

/kodadmina add <code_name> <choose is it an item or an command> <the command or the item> - to add a new code to the config.

๐Ÿ“Ž 1 file 1,128 chars
๐Ÿ“„
pasted-code-1784063413009.txt
txt 35 lines
โ–ถ
Hello, please create a simple Minecraft Spigot plugin for version 1.20+ using Java.

Plugin requirements:

Command: /kod {code}

This command is for players to redeem a code.

Crucial: Do not allow the command to suggest or auto-complete any arguments in the tab-complete menu.

When a player types /kod , the plugin should check if the code exists in a configuration file (config.yml).

If the code is valid, give the player the reward defined in the config and remove/disable the code so it cannot be used again.

Send a success message to the player.

Command: /kodadmina

This command is for administrators only (requires permission kod.admin).

It should have subcommands to manage codes:

/kodadmina add   - to add a new code to the config.

/kodadmina remove  - to remove a code.

/kodadmina list - to list all active codes.

Configuration:

Use a config.yml file to store the codes and their associated rewards.

Make sure the plugin saves data properly so that codes persist after a server restart.

Please provide the plugin.yml file and the Java code organized in a clean way.
Kodari AI
KodariJul 14 at 9:12 pm 7
CodeRedeemer
A simple Spigot 1.20+ code redemption plugin that lets players redeem one-time reward codes with /kod. Administrators manage item and command rewards through /kodadmina, including adding, removing, and listing active codes. Codes are stored persistently in config.yml, become disabled after successful redemption, support configurable messages, and provide administrator permission protection. The player redemption command intentionally provides no argument tab completion.
bambuslawek

Cannot find main class com.kodari.cod redeem.CodeRedeemerPlugin

Kodari AI
KodariJul 14 at 9:20 pm 2

Fixed plugin.yml:

YAML
main: com.kodari.codredeem.CodeRedeemerPlugin

The package name now matches the Java class location and declaration. Rebuild the plugin and restart the server.

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

import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public class CodeRedeemerPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        saveDefaultConfig();

        CodeManager codeManager = new CodeManager(this);

        KodCommand kodCommand = new KodCommand(this, codeManager);
        PluginCommand kod = getCommand("kod");
        if (kod != null) {
            kod.setExecutor(kodCommand);
            kod.setTabCompleter(kodCommand);
        }

        KodAdminCommand kodAdminCommand = new KodAdminCommand(this, codeManager);
        PluginCommand kodAdmina = getCommand("kodadmina");
        if (kodAdmina != null) {
            kodAdmina.setExecutor(kodAdminCommand);
            kodAdmina.setTabCompleter(kodAdminCommand);
        }

        Bukkit.getConsoleSender().sendMessage("CodeRedeemer enabled.");
    }
}