12345bartek

Generate a plugin for special heads that will execute commands (from the player's side) upon right-clicking and immediately disappear from the player's inventory. The config should include a space for the head's name, a description, and a value. The plugin should have no permissions.

Kodari AI
KodariJan 10 at 9:32 pm

I’ll create a plugin for special executable heads that run commands when right-clicked.

ExecutableHeads
A simple but powerful plugin that allows creation of special player heads that execute commands when right-clicked. Each head can be configured with custom textures, names, lore, and multiple commands. The heads automatically disappear from the player's inventory after use, making them perfect for single-use items, quest rewards, or special events.
12345bartek

The compilation failed with this error:

code
Validation failed for compilation: Compilation failed with 1 error(s):

ERROR in src/main/java/com/executableheads/ExecutableHeads.java at line 3: package com.executableheads.command does not exist
import com.executableheads.command.HeadCommand;
                                  ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/executableheads/ExecutableHeads.java
 exceeds maximum 

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

Kodari AI
KodariJan 10 at 9:33 pm 4,239 (v2)

I need to read the ExecutableHeads.java file to see what’s importing the non-existent HeadCommand class.

Analysis

  • ExecutableHeads.java imports and uses HeadCommand class

  • HeadCommand class does not exist in the project

  • Need to create the HeadCommand class

Created HeadCommand class with give, list, and reload subcommands to resolve the compilation error.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 390
src/main/java/com/executableheads/ExecutableHeads.java
package com.executableheads;

import com.executableheads.command.HeadCommand;
import com.executableheads.listener.HeadInteractListener;
import com.executableheads.manager.HeadManager;
import org.bukkit.plugin.java.JavaPlugin;

public class ExecutableHeads extends JavaPlugin {
    private HeadManager headManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.headManager = new HeadManager(this);
        this.headManager.loadHeads();
        
        getServer().getPluginManager().registerEvents(new HeadInteractListener(this.headManager), this);
        getCommand("executableheads").setExecutor(new HeadCommand(this, this.headManager));
        
        getLogger().info("ExecutableHeads has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("ExecutableHeads has been disabled!");
    }

    public HeadManager getHeadManager() {
        return this.headManager;
    }
}