itamar giasi

this is my prompt

📎 1 file 14,826 chars
📄
pasted-code-1791394148634.txt
txt 946 lines
▶
Create a complete, production-ready Minecraft server plugin called **DoniAdmin** from scratch.

I do NOT want to upload an existing project. Generate the entire project yourself, including all Java source files, Gradle files, `plugin.yml`, `config.yml`, and any other required resources.

## 1. EXACT TARGET ENVIRONMENT

Target:

* Minecraft: **26.2**
* Server software: **Paper**
* Bukkit compatibility: **Paper/Bukkit API**
* Paper API: **26.2**
* Java: **25**
* Build system: **Gradle**
* Language: **Java**
* Plugin name: **DoniAdmin**
* Version: **1.0.0**
* Main class: `me.doni.doniadmin.DoniAdmin`
* Package: `me.doni.doniadmin`

The final project MUST compile into a real `.jar`.

The resulting JAR must be usable by placing it directly inside:

`plugins/`

on a Paper 26.2 server.

Do NOT create a fake JAR by simply renaming a ZIP file.

---

# 2. PROJECT STRUCTURE

Create a clean Gradle project similar to:

DoniAdmin/

* `build.gradle.kts`
* `settings.gradle.kts`
* `README.md`
* `src/main/resources/plugin.yml`
* `src/main/resources/config.yml`
* `src/main/java/me/doni/doniadmin/DoniAdmin.java`
* `src/main/java/me/doni/doniadmin/CommandHandler.java`
* `src/main/java/me/doni/doniadmin/TargetResolver.java`
* `src/main/java/me/doni/doniadmin/AdminPanel.java`
* `src/main/java/me/doni/doniadmin/AdminListener.java`

You may split classes further if that produces cleaner and safer code.

Do NOT put the entire plugin into one enormous Java class.

---

# 3. IMPORTANT BUILD REQUIREMENTS

The project must compile without errors.

Before giving me the final result:

1. Compile the entire project.
2. Check every Java file for compilation errors.
3. Check `plugin.yml`.
4. Check that every command declared in `plugin.yml` is actually registered.
5. Check that every permission used by commands exists.
6. Check that all imports are valid for Paper 26.2.
7. Check that deprecated or removed APIs are not being used where a modern Paper 26.2 API is required.
8. Check that the plugin can load without throwing an exception.
9. Check that `config.yml` is valid YAML.
10. Check that the final JAR contains:

* compiled `.class` files
* `plugin.yml`
* `config.yml`

11. Make sure the main class specified in `plugin.yml` exactly matches the compiled main class.
12. Make sure there are no missing dependencies.

If something fails to compile, FIX IT before giving me the project.

Do not simply tell me that there is an error.

---

# 4. NO UNFINISHED CODE

Do NOT use:

* `TODO`
* `FIXME`
* placeholder methods
* fake implementations
* pseudocode
* comments saying "implement later"
* empty methods where functionality was requested
* nonexistent APIs
* made-up Paper classes
* made-up Bukkit classes
* fake Gradle dependencies

Everything requested below must actually work.

---

# 5. ADMIN PANEL

Create:

`/admpanel`

and:

`/admpanel `

The command opens a polished Bukkit inventory GUI.

The GUI should look like a proper administration control panel rather than a random chest.

Use configurable title and size.

Default title:

`&0DoniAdmin`

Default size:

6 rows.

Use recognizable Minecraft icons for buttons.

Suggested layout:

### Player controls

* Freeze
* Unfreeze
* Jail
* Unjail
* Bring
* Teleport Here
* Heal
* Feed
* Launch

### Server/fun controls

* Notify Everyone
* Set Jail
* Target Information
* Close

Use color-coded names and useful lore.

Prevent players from taking GUI items.

Do not allow normal inventory manipulation inside the admin GUI.

The GUI should close safely.

---

# 6. TARGET SYSTEM

Create a centralized target resolver.

Every target-based command should use it.

Supported target formats:

### Special targets

`me`

`@s`

`all`

`@a`

`random`

`@r`

`nearest`

`@p`

### Normal player names

Examples:

`Steve`

`Notch`

Also support partial player-name matching when unambiguous.

### Behavior

`me` / `@s`

* targets the command sender.

`all` / `@a`

* targets every online player.

`random` / `@r`

* chooses one random online player.

`nearest` / `@p`

* chooses the nearest online player to the command sender.

Username:

* targets that online player.

If no target exists, show a clean error.

Do not throw an exception.

---

# 7. COMMANDS

Implement all of these commands.

## `/admpanel [player]`

Opens the admin panel.

Permissions:

`doni.admpanel`

Default:

OP.

---

## `/ntfy `

Send a title notification to every online player.

Example:

`/ntfy Server restarting soon!`

Every online player should receive:

* title
* configurable subtitle
* configurable fade-in
* configurable stay time
* configurable fade-out
* configurable sound

Permission:

`doni.ntfy`

Default:

OP.

Use the modern Paper/Adventure title API where appropriate.

---

## `/freeze `

Freeze the selected player.

Permission:

`doni.admin.freeze`

Default:

OP.

Frozen players should not be able to move.

Do not kick them.

Do not damage them.

Do not modify their inventory.

Only prevent movement unless the configuration says otherwise.

---

## `/unfreeze `

Remove the freeze.

Permission:

`doni.admin.freeze`

Default:

OP.

---

## `/jail `

Teleport the target to the configured jail location.

Permission:

`doni.admin.jail`

Default:

OP.

The target should remain inside the configured jail area.

---

## `/unjail `

Release the player from jail.

Permission:

`doni.admin.jail`

Default:

OP.

---

## `/setjail`

Save the command sender's current location as the jail location.

Permission:

`doni.admin.jail`

Default:

OP.

Save:

* world
* X
* Y
* Z
* yaw
* pitch

to `config.yml`.

---

## `/bring `

Teleport selected player(s) to the command sender.

Permission:

`doni.admin.teleport`

Default:

OP.

---

## `/tphere `

Teleport the command sender to the selected player.

Permission:

`doni.admin.teleport`

Default:

OP.

---

## `/heal `

Set the player's health to their maximum.

Also clear fire.

Permission:

`doni.admin.heal`

Default:

OP.

---

## `/feed `

Set:

* food level = 20
* saturation = 20

Permission:

`doni.admin.feed`

Default:

OP.

---

## `/launch `

Launch the target upward.

Make the launch strength configurable.

Default:

`1.5`

Optionally spawn particles and play a sound.

Permission:

`doni.admin.launch`

Default:

OP.

---

## `/vanish`

Toggle vanish for the command sender.

When vanished:

* other players cannot see them.
* the vanished player can still move normally.
* the vanished player can still use commands.
* reconnecting should reset vanish unless persistence is explicitly implemented.

Permission:

`doni.admin.vanish`

Default:

OP.

---

# 8. PERMISSIONS

Every admin function must have its own permission.

Create:

`doni.admpanel`

`doni.ntfy`

`doni.admin.freeze`

`doni.admin.jail`

`doni.admin.teleport`

`doni.admin.heal`

`doni.admin.feed`

`doni.admin.launch`

`doni.admin.vanish`

Also create:

`doni.admin`

as a parent permission.

`doni.admin` should grant the individual admin permissions.

All permissions must default to:

`op`

This must work correctly with **LuckPerms**.

Do NOT hard-code OP checks into the Java code.

Use Bukkit/Paper permission checks such as:

`sender.hasPermission(...)`

so LuckPerms can control access.

---

# 9. TAB COMPLETION

Implement tab completion for every target-based command.

For example:

`/freeze `

should suggest:

* me
* all
* random
* nearest
* online player names

Also support:

* @s
* @a
* @r
* @p

Filter suggestions based on what the user has typed.

---

# 10. CONFIG.YML

Make the plugin highly configurable.

Include:

### Messages

* prefix
* no permission
* player not found
* players only
* command usage
* success messages
* error messages

### Notifications

* fade-in
* stay
* fade-out
* sound
* volume
* pitch
* subtitle

### Freeze

* cancel movement
* cancel interaction
* show freeze message

### Jail

* jail world
* X
* Y
* Z
* yaw
* pitch
* prevent movement outside jail
* teleport back on release if implemented

### Launch

* strength
* particles
* sound

### Panel

* title
* number of rows

Do not hard-code values that should reasonably be configurable.

---

# 11. ERROR HANDLING

The plugin must fail gracefully.

Examples:

If someone runs:

`/freeze`

show:

`Usage: /freeze `

If someone targets a player who is offline:

`No matching online player was found.`

If `/setjail` has never been used and someone tries:

`/jail Steve`

show:

`Jail location has not been configured.`

Do not throw stack traces for normal user mistakes.

---

# 12. CONSOLE COMPATIBILITY

Commands that require a player should clearly reject console execution.

For example:

`/setjail`

should say:

`This command can only be used by a player.`

Commands such as `/freeze Steve`, `/heal Steve`, etc. should work from console when a target is explicitly provided.

Commands that require the sender's location, such as `/bring` or `/tphere`, should reject console when necessary.

---

# 13. GUI SAFETY

The admin GUI must:

* cancel item movement
* cancel shift-clicking
* cancel hotbar swapping
* cancel number-key movement
* prevent dragging items
* prevent taking GUI items
* prevent placing items into the GUI
* safely handle closing
* never duplicate items

Do not allow normal inventory actions to corrupt the GUI.

---

# 14. ADMIN PANEL TARGETING

When using:

`/admpanel Steve`

Steve becomes the selected target.

The GUI should visibly display:

`Target: Steve`

Buttons such as Freeze, Jail, Heal, Feed, Launch, etc. should operate on Steve.

If `/admpanel` is used without a target, display:

`No target selected`

and explain that:

`/admpanel `

can be used to select one.

---

# 15. VISUAL STYLE

Use a clean Doni SMP style.

Preferred colors:

* cyan
* dark gray
* white
* light blue
* green for positive actions
* red for dangerous/destructive admin actions
* gold for important actions

Do not make the GUI excessively complicated.

It should look clean and readable.

---

# 16. SOUND AND PARTICLES

Use valid Minecraft/Paper 26.2 sound and particle constants.

Do NOT invent names.

If a configured sound is invalid, safely fall back to a valid default instead of crashing.

---

# 17. CHAT COLORS

Support standard Bukkit color codes:

`&a`

`&b`

`&c`

etc.

Make all configurable messages support these color codes.

---

# 18. PLAYER QUIT HANDLING

When a player disconnects:

* remove them from the frozen set
* remove temporary vanish state
* clean up temporary admin state where appropriate

Do not leave stale UUIDs forever.

---

# 19. PLUGIN ENABLE/DISABLE

On startup:

* load configuration
* register commands
* register listeners
* initialize managers
* print a clean startup message

Example:

`DoniAdmin 1.0.0 enabled successfully.`

On shutdown:

`DoniAdmin disabled.`

Do not print unnecessary spam.

---

# 20. CODE QUALITY

Use clean object-oriented Java.

Prefer separate classes/managers for:

* main plugin
* commands
* target resolution
* admin GUI
* listeners
* state management

Use clear names.

Avoid gigantic methods.

Avoid unnecessary dependencies.

Only depend on Paper API.

Do not require Vault, PlaceholderAPI, EssentialsX, LuckPerms, or any other plugin for the core functionality.

LuckPerms should work with it automatically because permissions use the normal Bukkit/Paper permission system.

---

# 21. IMPORTANT: DO NOT ADD THESE

Do NOT add:

* real-world weapons
* real-world weapon instructions
* gambling mechanics
* randomized paid loot boxes
* external databases
* telemetry
* analytics
* advertisements
* remote connections
* backdoors
* OP-granting commands
* permission bypasses
* hidden commands
* code that downloads files from unknown websites
* code that sends server/player information anywhere
* obfuscated malicious code

Keep the plugin self-contained and server-local.

---

# 22. NO BROKEN API USAGE

This is extremely important.

Do not blindly use APIs from older Minecraft versions.

The target is specifically:

**Paper 26.2**

Use APIs that actually exist in Paper 26.2.

If an older Bukkit method still exists and is safe, it may be used, but prefer modern Paper APIs where appropriate.

Do not invent classes, methods, events, materials, sounds, particles, or command APIs.

---

# 23. BUILD FILE

Generate a correct `build.gradle.kts`.

Use:

* Java 25
* Paper API 26.2
* Gradle Kotlin DSL

Use the correct Paper Maven repository.

The build must produce:

`build/libs/DoniAdmin-1.0.0.jar`

Do not include the Paper server itself inside the JAR.

Paper API should be a compile-only dependency.

---

# 24. PLUGIN.YML

Generate a complete valid `plugin.yml`.

It must contain:

* name
* version
* main
* description
* author
* api-version
* all commands
* all permissions

The main class must be exactly:

`me.doni.doniadmin.DoniAdmin`

Do not accidentally use:

`Main`

or another class name.

---

# 25. FINAL VALIDATION

Before considering the project finished, perform a full build.

Run the equivalent of:

`gradle clean build`

The result MUST be:

`BUILD SUCCESSFUL`

Then verify:

`build/libs/DoniAdmin-1.0.0.jar`

exists.

Inspect the JAR and confirm it contains:

* `plugin.yml`
* `config.yml`
* `me/doni/doniadmin/DoniAdmin.class`
* all required compiled classes

Make sure there are no compilation errors.

---

# 26. FINAL RESPONSE

When everything is finished, give me:

1. The complete generated project.
2. The compiled `.jar`.
3. The exact JAR filename.
4. The required Java version.
5. The exact Paper/Minecraft version.
6. A short installation guide.
7. A list of all commands.
8. A list of all permission nodes.

Most importantly:

**I need a REAL COMPILED `.jar`, not a ZIP renamed to `.jar`.**

Do not tell me to finish the code myself.

Do not leave compilation for me.

Build and validate the project before giving me the final result.
Kodari AI
KodariOct 7 at 5:33 pm 3
DoniAdmin
DoniAdmin is a comprehensive Paper 26.2 administration plugin featuring a polished GUI admin panel, advanced target resolution system, and extensive player management commands. It includes freeze, jail, teleport, heal, feed, launch, vanish, and notification systems with full configuration support. The plugin features a centralized target resolver supporting special selectors, robust tab completion, configurable messages and settings, and safe GUI handling. All commands use proper permission checks for LuckPerms compatibility, with graceful error handling and console support where appropriate.
  1. Create the Gradle project, plugin metadata, and configurable defaults.

  2. Implement target resolution, admin state, commands, and tab completion.

  3. Add the protected admin GUI, listeners, and lifecycle wiring.

Created the DoniAdmin project with Paper API 26.2 and Java 25 build settings. The configured JAR filename is DoniAdmin-1.0.0.jar.

To produce and download the real compiled JAR in Kodari:

  1. Click Compile in the desktop top bar, or on phone tap ⋮ → Compile Project.

  2. Click Compile in the window.

  3. After it succeeds, download the build or use the Download DoniAdmin-1.0.0.jar button.

Install the downloaded JAR in the server’s plugins/ directory and restart Paper. Configure the plugin in plugins/DoniAdmin/config.yml; panel rows are configurable from 4 to 6.

Commands

  • /admpanel [player]

  • /ntfy <message>

  • /freeze <target> and /unfreeze <target>

  • /jail <target> and /unjail <target>

  • /setjail

  • /bring <target> and /tphere <target>

  • /heal <target>, /feed <target>, /launch <target>

  • /vanish

Permissions doni.admin grants all permissions below: doni.admpanel, doni.ntfy, doni.admin.freeze, doni.admin.jail, doni.admin.teleport, doni.admin.heal, doni.admin.feed, doni.admin.launch, doni.admin.vanish.

All permission nodes default to operators and use Bukkit’s permission system.

itamar giasi

add more cool admin commands to the admin panel and add a crates like the plugin exellent crates and i want like 100 new commands to the admin panel and each one would be cool and make the plugin have god items which will be able to give using /godgive <itemname> and make it have all types of weapons and tools and armor and each one would be like kind of overpowered but not too much

Kodari AI
KodariOct 7 at 5:58 pm 4
  1. Extend the admin panel with a large set of useful admin actions.

  2. Add a crate system with crate types, keys, and opening/rewards.

  3. Add /godgive <itemname> with balanced overpowered weapons, tools, and armor.

  1. Admin panel: add a paginated catalog of 100 configurable admin actions, permission-gated and target-aware.

  2. Keep the existing quick-action page, and merge new defaults into existing configs.

  3. Add crate functionality next, then balanced /godgive gear.

  1. Admin panel: added a paginated, permission-gated catalog of 100 configurable actions. Next: crate behavior and storage.

  1. Crates: add named PDC-backed keys, configurable weighted item rewards, /crate open|list|givekey, and admin permission checks; key consumption happens only when a valid reward is available.

  1. God items: add /godgive <itemname> [player] for moderately upgraded netherite combat gear, tools, ranged weapons, and armor, with tab-completed names.

  1. Admin panel: Added exactly 100 paginated, configurable admin actions—including effects, game modes, gear, enchants, teleports, and server settings. /admpanel [player] opens the panel; actions require doni.admin.panel-actions.

  2. Crates: Added starter and epic crates with weighted rewards and metadata-tagged keys. Players can right-click a key or use /crate open <crate>; admins can grant keys with /crate givekey <player> <crate> [amount].

  3. God items: Added 18 upgraded weapon, tool, and armor presets. Use /godgive <itemname> [player]; names are tab-completed, and the command requires doni.admin.godgive.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle.kts
README.md
settings.gradle.kts
Code
13 1,886
src/main/java/me/doni/doniadmin/DoniAdmin.java
package me.doni.doniadmin;

import java.time.Duration;
import java.util.Locale;
import me.doni.doniadmin.gui.AdminListener;
import me.doni.doniadmin.gui.AdminPanel;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class DoniAdmin extends JavaPlugin {
    private AdminState adminState;
    private TargetResolver targetResolver;
    private CrateManager crateManager;
    private GodItemManager godItemManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        getConfig().options().copyDefaults(true);
        saveConfig();
        adminState = new AdminState();
        targetResolver = new TargetResolver(this);
        crateManager = new CrateManager(this);
        godItemManager = new GodItemManager();

        CommandHandler commandHandler = new CommandHandler(this);
        for (String name : new String[]{"admpanel", "ntfy", "freeze", "unfreeze", "jail", "unjail", "setjail", "bring", "tphere", "heal", "feed", "launch", "vanish", "crate", "godgive"}) {
            PluginCommand command = getCommand(name);
            if (command != null) {
                command.setExecutor(commandHandler);
                command.setTabCompleter(commandHandler);
            }
        }
        Bukkit.getPluginManager().registerEvents(new AdminListener(this), this);
        getLogger().info("DoniAdmin 1.0.0 enabled successfully.");
    }

    @Override
    public void onDisable() {
        if (adminState != null) {
            for (Player vanished : Bukkit.getOnlinePlayers()) {
                if (adminState.isVanished(vanished)) {
                    for (Player viewer : Bukkit.getOnlinePlayers()) {
                        if (viewer != vanished) {
                            viewer.showPlayer(this, vanished);
                        }
                    }
                }
            }
        }
        getLogger().info("DoniAdmin disabled.");
    }

    public AdminState getAdminState() {
        return adminState;
    }

    public TargetResolver getTargetResolver() {
        return targetResolver;
    }

    public CrateManager getCrateManager() {
        return crateManager;
    }

    public GodItemManager getGodItemManager() {
        return godItemManager;
    }

    public void sendMessage(CommandSender recipient, String key, String... replacements) {
        String message = getConfig().getString("messages." + key, key);
        for (int i = 0; i + 1 < replacements.length; i += 2) {
            message = message.replace("%" + replacements[i] + "%", replacements[i + 1]);
        }
        recipient.sendMessage(color(getConfig().getString("messages.prefix", "") + message));
    }

    public String color(String text) {
        return org.bukkit.ChatColor.translateAlternateColorCodes('&', text);
    }

    public Location getJailLocation() {
        String worldName = getConfig().getString("jail.world", "");
        if (worldName == null || worldName.isBlank()) {
            return null;
        }
        org.bukkit.World world = Bukkit.getWorld(worldName);
        if (world == null) {
            return null;
        }
        return new Location(world,
                getConfig().getDouble("jail.x"),
                getConfig().getDouble("jail.y"),
                getConfig().getDouble("jail.z"),
                (float) getConfig().getDouble("jail.yaw"),
                (float) getConfig().getDouble("jail.pitch"));
    }

    public void setJailLocation(Location location) {
        getConfig().set("jail.world", location.getWorld().getName());
        getConfig().set("jail.x", location.getX());
        getConfig().set("jail.y", location.getY());
        getConfig().set("jail.z", location.getZ());
        getConfig().set("jail.yaw", location.getYaw());
        getConfig().set("jail.pitch", location.getPitch());
        saveConfig();
    }

    public void notifyEveryone(String message) {
        LegacyComponentSerializer serializer = LegacyComponentSerializer.legacyAmpersand();
        net.kyori.adventure.text.Component title = serializer.deserialize(message);
        net.kyori.adventure.text.Component subtitle = serializer.deserialize(getConfig().getString("notifications.subtitle", ""));
        long fadeIn = Math.max(0, getConfig().getLong("notifications.fade-in", 10)) * 50L;
        long stay = Math.max(0, getConfig().getLong("notifications.stay", 60)) * 50L;
        long fadeOut = Math.max(0, getConfig().getLong("notifications.fade-out", 10)) * 50L;
        net.kyori.adventure.title.Title.Times times = net.kyori.adventure.title.Title.Times.times(
                Duration.ofMillis(fadeIn), Duration.ofMillis(stay), Duration.ofMillis(fadeOut));
        net.kyori.adventure.title.Title notification = net.kyori.adventure.title.Title.title(title, subtitle, times);
        for (Player player : Bukkit.getOnlinePlayers()) {
            player.showTitle(notification);
            playConfiguredSound(player, "notifications.sound", "ui.toast.challenge_complete",
                    "notifications.volume", "notifications.pitch");
        }
    }

    public void launch(Player player) {
        player.setVelocity(new org.bukkit.util.Vector(0, getConfig().getDouble("launch.strength", 1.5), 0));
        if (getConfig().getBoolean("launch.particles", true)) {
            String particleName = getConfig().getString("launch.particle", "cloud");
            NamespacedKey particleKey = namespacedKey(particleName);
            org.bukkit.Particle particle = particleKey == null ? null : Registry.PARTICLE_TYPE.get(particleKey);
            if (particle == null) {
                particle = Registry.PARTICLE_TYPE.get(NamespacedKey.minecraft("cloud"));
            }
            if (particle != null) {
                player.getWorld().spawnParticle(particle, player.getLocation().add(0, 1, 0), 20, 0.25, 0.3, 0.25, 0.05);
            }
        }
        playConfiguredSound(player, "launch.sound", "entity.firework_rocket.launch", "launch.volume", "launch.pitch");
    }

    public Attribute getMaximumHealthAttribute() {
        return Registry.ATTRIBUTE.get(NamespacedKey.minecraft("max_health"));
    }

    private void playConfiguredSound(Player player, String soundPath, String fallback,
                                     String volumePath, String pitchPath) {
        String configured = getConfig().getString(soundPath, fallback);
        NamespacedKey key = namespacedKey(configured);
        Sound sound = key == null ? null : Registry.SOUNDS.get(key);
        if (sound == null) {
            NamespacedKey fallbackKey = namespacedKey(fallback);
            sound = fallbackKey == null ? null : Registry.SOUNDS.get(fallbackKey);
        }
        if (sound != null) {
            player.playSound(player.getLocation(), sound,
                    (float) getConfig().getDouble(volumePath, 1.0),
                    (float) getConfig().getDouble(pitchPath, 1.0));
        }
    }

    private NamespacedKey namespacedKey(String value) {
        if (value == null || value.isBlank()) {
            return null;
        }
        String normalized = value.toLowerCase(Locale.ROOT);
        return normalized.contains(":") ? NamespacedKey.fromString(normalized) : NamespacedKey.minecraft(normalized);
    }

    public void openPanel(Player player, Player target) {
        new AdminPanel(this, player, target).open();
    }
}