12345bartek

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

Kodari AI
KodariJan 10 at 9:56 pm 5,525 (v2)

I’ll create a special heads plugin that executes commands on right-click and removes the head from inventory.

SpecialHeads
A lightweight plugin that allows players to use special heads that execute custom commands when right-clicked. Each head is fully configurable with custom textures, names, lore, and multiple commands that run from both player and console contexts. After activation, the head automatically disappears from the player's inventory. Perfect for creating consumable reward items or special ability triggers.

Plugin created successfully! SpecialHeads allows players to right-click special heads that execute commands and disappear.

Features:

  • 4 pre-configured heads: Home Teleport, Healing, Money Reward, and Flight

  • Each head has custom texture, name, and lore

  • Supports both player and console commands

  • Automatic removal after use

  • No permissions required

  • Placeholder %player% for all commands

Config structure: Each head has name, lore, texture, player_commands, and console_commands. Add more heads by copying the format in config.yml.

12345bartek

and add special commands to add heads from this plugin

Kodari AI
KodariJan 10 at 9:58 pm 8,465 (v2)

I’ll read the existing files first to understand the current structure, then add commands to manage heads.

Now I’ll create a command system to add, remove, list, give, and reload heads.

Plan:

  • Create SpecialHeadsCommand class with subcommands (add, remove, list, give, reload)

  • Add methods to HeadManager for saving/removing heads

  • Register command in plugin.yml

  • Update main plugin class to register command

Commands added successfully! The plugin now has:

Commands:

  • /specialheads add <id> <name> <texture> [commands...] --console <console_commands> - Create new heads

  • /specialheads remove <id> - Remove heads

  • /specialheads list - View all configured heads

  • /specialheads give <player> <id> [amount] - Give heads to players

  • /specialheads reload - Reload configuration

Aliases: /sh, /shead, /sheads

Permissions: All admin commands require op by default, with granular permissions for each action.

12345bartek

add permision for use this head

Kodari AI
KodariJan 10 at 10:47 pm 6,501 (v2)

I’ll add permissions for using special heads. Let me first check the current implementation.

I’ll add a permission system for using individual heads. This will allow you to control who can use specific heads.

Added permission system for individual heads:

  • Per-head permission: specialheads.use.<head_id> - Required to use a specific head

  • All heads permission: specialheads.use.* - Grants access to all heads (default: op)

  • No permission message: Configurable in config.yml under messages.no-permission

Example permissions:

  • specialheads.use.example_spawn - Can use the spawn teleporter head

  • specialheads.use.example_kit - Can use the starter kit head

  • specialheads.use.example_money - Can use the money voucher head

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
9 618
src/main/java/com/specialheads/SpecialHeadsPlugin.java
package com.specialheads;

import com.specialheads.command.SpecialHeadsCommand;
import com.specialheads.listener.HeadClickListener;
import com.specialheads.manager.HeadManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class SpecialHeadsPlugin extends JavaPlugin {
    private HeadManager headManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.headManager = new HeadManager(this);
        this.headManager.loadHeadsFromConfig();
        
        getServer().getPluginManager().registerEvents(new HeadClickListener(this), this);
        
        SpecialHeadsCommand commandExecutor = new SpecialHeadsCommand(this);
        getCommand("specialheads").setExecutor(commandExecutor);
        getCommand("specialheads").setTabCompleter(commandExecutor);
        
        getLogger().info("SpecialHeads has been enabled!");
        getLogger().info("Loaded " + headManager.getHeadCount() + " special heads");
    }

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