tyvek_

create me a fully configurable lootbox plugin with an ingame editor to work on the latest minecraft version paper version, name the plugin AstrosLootBoxes

Kodari AI
KodariAug 6 at 6:31 pm 3
AstrosLootBoxes
A fully configurable lootbox plugin for Paper with an in-game editor. Players can open lootboxes to receive random rewards from configurable loot tables with weighted chances. The plugin features a GUI-based editor allowing admins to create, edit, and manage lootboxes, their rewards, and drop rates directly in-game. Includes configurable opening animations, reward previews, cooldowns, and permission-based access. All lootbox data is stored in YAML configuration files for easy manual editing. The editor GUI provides intuitive item-based controls for adding rewards, setting probabilities, and customizing lootbox appearance and behavior.
  1. Create the Gradle project, plugin metadata, default configuration, and sample loot boxes.

  2. Add loot-box models, YAML persistence, weighted reward opening, item tagging, and commands.

  3. Add the reusable inventory GUI framework plus list, box editor, reward editor, and chat prompts.

  4. Register listeners and wire the plugin lifecycle, reload flow, and Paper-compatible cross-version item/sound handling.

Created AstrosLootBoxes, a configurable Paper loot-box plugin with:

  • Gradle project targeting Paper 1.21.4 and Java 21

  • YAML-based loot-box and reward configuration

  • Weighted random reward selection

  • Custom loot-box items using persistent data tags

  • Configurable display names, lore, materials, model data, commands, messages, broadcasts, and animations

  • /lootbox list

  • /lootbox open <box>

  • /lootbox give <player> <box> [amount]

  • /lootbox editor

  • /lootbox reload

  • In-game loot-box editor

  • In-game reward editor

  • Chat prompts for editing values

  • GUI event management framework

  • XSeries-based material and sound compatibility

  • Sample starter loot box configuration

tyvek_

The compilation failed with this error:

code
Compilation failed with 1 error(s):

ERROR in src/main/java/com/astros/lootboxes/INVENTORY GUI/LootBoxListGUI.java at line 64: ')' or ',' expected
                });
                  ^


=== COMPILATION ERROR ANALYSIS ===

SYNTAX ERRORS:
  - Line 64: ')' or ',' expected
ACTION: Check for missing semicolons or brackets

FILES TO INVESTIGATE:
  - src/main/java/com/astros/lootboxes/INVENTORY GUI/LootBoxListGUI.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariAug 6 at 6:52 pm 1

Plan:

  1. Inspect LootBoxListGUI.java and the types it directly uses.

  2. Correct the malformed GUI button/lambda syntax without changing behavior.

  3. Create the corrected artifact at the existing source path.

Fixed the syntax error in LootBoxListGUI.java by correctly closing the InventoryButton.consumer(...) call.

Corrected artifact: src/main/java/com/astros/lootboxes/gui/LootBoxListGUI.java

tyvek_

can you give me a list on how the plugin works

Kodari AI
KodariAug 6 at 6:54 pm 1

AstrosLootBoxes — How It Works

  1. Loot boxes are configured in YAML

    • Loot boxes are stored in src/main/resources/lootboxes.yml.

    • Each box can have:

      • Display name

      • Material/icon

      • Lore

      • Custom model data

      • Rewards

      • Reward chances/weights

      • Opening animation settings

      • Broadcast messages

      • Player messages

  2. Players receive loot-box items

    • Loot-box items contain a hidden plugin data tag.

    • This tag identifies which configured loot box the item belongs to.

    • Players can receive boxes through commands or other server systems.

  3. Players open loot boxes

    • A player right-clicks a loot-box item.

    • The plugin verifies that the item is a valid configured loot box.

    • One reward is selected using weighted random chances.

    • The loot-box item is consumed.

    • The configured reward is granted.

  4. Rewards can contain items and commands

    • Rewards may give players configured Minecraft items.

    • Rewards can also execute commands.

    • Commands can use the player’s name as a placeholder.

    • This allows rewards such as money, permissions, ranks, keys, or special items.

  5. Reward chances use weights

    • Each reward has a weight rather than requiring percentages.

    • Example:

      • Common reward: weight 70

      • Rare reward: weight 25

      • Legendary reward: weight 5

    • The total weight is calculated automatically.

    • Higher-weight rewards are more likely to be selected.

  6. The plugin supports opening effects

    • Opening messages and sounds can be configured.

    • The plugin can display reward announcements.

    • Broadcasts can be enabled for special rewards or box openings.

  7. Loot boxes can be given with commands

    Plain Text
    /lootbox give <player> <box> [amount]
    

    Example:

    Plain Text
    /lootbox give Steve starter 3
    
  8. Players can view available loot boxes

    Plain Text
    /lootbox list
    

    This opens a GUI showing the configured loot boxes.

  9. Players can open a configured box by command

    Plain Text
    /lootbox open <box>
    

    Example:

    Plain Text
    /lootbox open starter
    

    This is useful for testing or for boxes that do not require a physical item.

  10. Administrators can use the in-game editor

    Plain Text
    /lootbox editor
    

    The editor allows administrators to:

    • View existing loot boxes

    • Create or edit loot boxes

    • Change names and materials

    • Edit lore

    • Manage rewards

    • Add rewards

    • Remove rewards

    • Change reward weights

    • Configure box behavior

  11. The editor uses inventory GUIs

    • The main editor displays all available boxes.

    • Clicking a box opens its settings.

    • The reward editor displays the rewards inside that box.

    • Buttons are used to modify settings directly in-game.

  12. Chat prompts are used for text input

    • When a setting requires text, the plugin closes the GUI temporarily.

    • The administrator enters the new value in chat.

    • The value is saved and the editor GUI reopens.

  13. Configuration can be reloaded

    Plain Text
    /lootbox reload
    

    This reloads the plugin’s configuration and loot-box data without restarting the server.

  14. Main configuration files

    Plain Text
    src/main/resources/config.yml
    

    Contains general plugin settings, messages, sounds, and behavior.

    Plain Text
    src/main/resources/lootboxes.yml
    

    Contains the loot-box definitions and rewards.

  15. Typical player workflow

    Plain Text
    Administrator creates a loot box
    → Administrator adds rewards and weights
    → Player receives the loot-box item
    → Player right-clicks the item
    → Plugin selects a weighted reward
    → Item or command reward is delivered
    → Opening message or broadcast is displayed
    
  16. Typical administrator workflow

    Plain Text
    /lootbox editor
    → Create or select a loot box
    → Configure its appearance
    → Add rewards
    → Set reward weights
    → Save changes
    → Give the box to players
    
tyvek_

put into a .txt

Kodari AI
KodariAug 6 at 6:55 pm 1

Created AstrosLootBoxes-How-It-Works.txt containing the plugin usage guide.

Kodari can make mistakes. Review important code before using.
Files
src
AstrosLootBoxes-How-It-Works.txt
build.gradle
manifest.kod
settings.gradle
Code
25 1,266
src/main/java/com/astros/lootboxes/AstrosLootBoxes.java
package com.astros.lootboxes;

import com.astros.lootboxes.command.LootBoxCommand;
import com.astros.lootboxes.editor.ChatPromptManager;
import com.astros.lootboxes.gui.GUIListener;
import com.astros.lootboxes.gui.GUIManager;
import com.astros.lootboxes.listener.LootBoxListener;
import com.astros.lootboxes.manager.LootBoxManager;
import com.astros.lootboxes.manager.LootBoxService;
import com.astros.lootboxes.util.Text;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class AstrosLootBoxes extends JavaPlugin {
    private LootBoxManager lootBoxManager;
    private LootBoxService lootBoxService;
    private GUIManager guiManager;
    private ChatPromptManager chatPromptManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        lootBoxManager = new LootBoxManager(this);
        lootBoxManager.load();
        lootBoxService = new LootBoxService(this, lootBoxManager);
        guiManager = new GUIManager();
        chatPromptManager = new ChatPromptManager(this);

        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new LootBoxListener(this, lootBoxManager, lootBoxService), this);
        Bukkit.getPluginManager().registerEvents(chatPromptManager, this);

        LootBoxCommand command = new LootBoxCommand(this);
        getCommand("lootbox").setExecutor(command);
        getCommand("lootbox").setTabCompleter(command);
    }

    public String message(String key, String... replacements) {
        String value = getConfig().getString("messages." + key, key);
        return Text.replace(Text.color(value), replacements);
    }

    public LootBoxManager getLootBoxManager() {
        return lootBoxManager;
    }

    public LootBoxService getLootBoxService() {
        return lootBoxService;
    }

    public GUIManager getGuiManager() {
        return guiManager;
    }

    public ChatPromptManager getChatPromptManager() {
        return chatPromptManager;
    }
}