Codrin
πŸ“Ž 1 file 3,169 chars
πŸ“„
pasted-code-1790424843043.txt
txt 213 lines
β–Ά
Create a large, reliable Kit Plugin for my Scripted SMP.

KIT GUI

The main kit system MUST have a GUI.

/kit

should open the Kit GUI.

The GUI is where players browse and select kits.

Kit GUI pages

The system should support up to 1,000 pages.

Each page should support up to 100 kit entries.

Because Minecraft inventory GUIs have a physical slot limit, split the 100 entries across multiple GUI screens when necessary, while treating them as one page.

Players should have:

Next Page

Previous Page

First Page

Last Page

Close

The GUI should clearly show the current page, for example:

Kit Page 1 / 1000

Kit buttons

Every kit should appear as a customizable item in the GUI.

For example:

Starter Kit β†’ Chest

Warrior Kit β†’ Iron Sword

Miner Kit β†’ Diamond Pickaxe

Builder Kit β†’ Bricks

VIP Kit β†’ Nether Star

The admin should be able to change the GUI item for every kit.

Each kit button should display:

Kit name

Kit description

Cooldown

Whether the player can claim it

Required permission

Clicking a kit

When a player clicks a kit in the GUI, open a Kit Preview GUI.

The preview must show exactly what the player will receive.

The preview should have:

Claim Kit

Back

Close

buttons.

Clicking Claim Kit gives the player the exact configured kit.

Kit GUI editor

Admins should be able to customize the GUI.

/kit edit 

The admin should be able to configure:

Kit GUI item

Kit GUI item name

Kit GUI lore

Kit GUI slot

Kit preview

Kit contents

Kit cooldown

Kit permission

Also allow configuration of:

GUI title

Background/filler items

Next Page button

Previous Page button

First Page button

Last Page button

Close button

Button names

Button lore

Button slots

Kit creation

/kit create 

Create a kit from the admin's current inventory.

Save everything exactly:

Main inventory slots

Hotbar slots

Armor slots

Off-hand slot

Item amounts

Enchantments

Custom names

Lore

Potion data

Other item properties

Kit accuracy

When a player claims a kit, give them exactly what was configured.

Do not randomly move, remove, duplicate or replace items.

The preview must accurately match the actual kit.

Inventory protection

Before giving a kit, check that the player has enough inventory space.

If they don't, do not partially give the kit.

Tell them:

You don't have enough inventory space for this kit.

Prevent item duplication and item loss.

Commands

/kit β€” Open Kit GUI

/kit  β€” Claim a kit directly

/kit list β€” List kits

/kit create  β€” Create a kit

/kit edit  β€” Edit a kit

/kit delete  β€” Delete a kit

/kit give   β€” Give a kit

/kit reload β€” Reload configuration

Permissions

kit.use

kit.

kit.admin

kit.*

OPs automatically have all permissions.

Storage

Save kits, GUI settings, cooldowns and player claims permanently so everything survives server restarts.

The plugin should be optimized and reliable even with thousands of kits.
Kodari AI
KodariSep 26 at 12:16 pm 1
KitMasterGUI
A comprehensive kit management plugin featuring a paginated GUI system supporting up to 1,000 pages with 100 kits per page. Players browse kits through an intuitive interface with navigation buttons, preview exact kit contents before claiming, and receive items with full inventory space validation to prevent loss. Admins create kits from their inventory, edit GUI items, slots, lore, cooldowns, permissions, and customize all interface elements including titles, filler items, and navigation buttons. Persistent YAML storage ensures kits, cooldowns, and settings survive restarts. Commands include /kit, /kit create, /kit edit, /kit delete, /kit give, and /kit reload with granular permissions for use, individual kit access, and admin control.
  1. Add the Paper/Gradle plugin scaffold and persistent kit storage.

  2. Implement kit commands, permissions, inventory-safe claims, and cooldown persistence.

  3. Add paginated browse and preview GUIs with configurable controls and kit editing.

Created the ScriptedKits plugin with a paginated kit browser and preview GUI. Each logical page holds up to 100 kits, split across screens, with first/previous/next/last page controls.

  • /kit create <name> saves the creator’s inventory, armor, and off-hand. ItemStacks are persisted with their metadata.

  • Claims check inventory capacity before changing anything, preserve existing equipment, and store cooldowns across restarts.

  • Added /kit <name>, /kit list, /kit edit, /kit delete, /kit give, and /kit reload, with kit and admin permissions.

  • Configure global GUI titles, filler, buttons, and slots in config.yml; edit each kit’s icon, name, lore, slot, cooldown, permission, and contents with /kit edit <name> <property>.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 1,169
src/main/java/com/kodari/scriptedkits/ScriptedKitsPlugin.java
package com.kodari.scriptedkits;

import com.kodari.scriptedkits.command.KitCommand;
import com.kodari.scriptedkits.gui.KitMenuListener;
import com.kodari.scriptedkits.kit.KitManager;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class ScriptedKitsPlugin extends JavaPlugin {
    private KitManager kitManager;
    private KitMenuListener menuListener;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("kits.yml", false);
        kitManager = new KitManager(this);
        menuListener = new KitMenuListener(this);

        PluginCommand kitCommand = getCommand("kit");
        if (kitCommand == null) {
            getLogger().severe("The kit command is missing from plugin.yml.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        KitCommand executor = new KitCommand(this);
        kitCommand.setExecutor(executor);
        kitCommand.setTabCompleter(executor);
        Bukkit.getPluginManager().registerEvents(menuListener, this);
    }

    public KitManager getKitManager() {
        return kitManager;
    }

    public KitMenuListener getMenuListener() {
        return menuListener;
    }

    public void reloadPlugin() {
        reloadConfig();
        kitManager.reload();
    }
}