HASSAN OP

Develop a plugin that allows players to obtain a "Souls" item, featuring a custom texture that resembles a ghost, and a 3D skull model as an alternative texture option. Include a command for players to toggle between the two textures and ensure compatibility with existing resource packs for seamless integration.

Kodari AI
KodariSep 11 at 3:08 pm 1
SoulTextureToggle
Provides players with a "Souls" item featuring custom ghost and 3D skull textures. Includes a toggle command to switch between texture variants, ensuring seamless integration with existing resource packs through configurable texture paths and item metadata management.
  1. Create the Gradle plugin project and resource-pack-compatible configuration.

  2. Add persistent per-player texture preferences and Souls item creation/update logic.

  3. Register /souls, /souls get, /souls give, and /souls toggle with inventory-wide texture switching.

Built the Souls plugin from scratch with:

  • /souls, /souls get, /souls give, and /souls toggle

  • Persistent per-player texture preferences

  • Ghost and 3D skull texture variants using configurable CustomModelData

  • Automatic updating of existing Souls items when toggling

  • Persistent item identification through PersistentDataContainer

  • Configurable material, names, lore, model IDs, and messages

  • Resource-pack-safe behavior: the plugin does not send or replace resource packs

  • XSeries-based material compatibility for supported Minecraft versions

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 362
src/main/java/com/kodari/souls/SoulsPlugin.java
package com.kodari.souls;

import com.kodari.souls.command.SoulsCommand;
import com.kodari.souls.data.PlayerPreferenceStore;
import com.kodari.souls.item.SoulsItemFactory;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class SoulsPlugin extends JavaPlugin {
    private PlayerPreferenceStore preferenceStore;
    private SoulsItemFactory itemFactory;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.preferenceStore = new PlayerPreferenceStore(this);
        this.itemFactory = new SoulsItemFactory(this);

        SoulsCommand command = new SoulsCommand(this, itemFactory, preferenceStore);
        PluginCommand soulsCommand = Objects.requireNonNull(getCommand("souls"));
        soulsCommand.setExecutor(command);
        soulsCommand.setTabCompleter(command);
    }

    public PlayerPreferenceStore getPreferenceStore() {
        return preferenceStore;
    }

    public SoulsItemFactory getItemFactory() {
        return itemFactory;
    }
}