sqeeties

Make it fully configurable

📎 1 file 6,002 chars
📄
pasted-code-1775904347525.txt
txt 268 lines
▶
You are a senior Minecraft plugin developer. Generate a complete, production-ready Spigot/Paper 1.19.4 plugin named "StarItems" with FULLY CONFIG-DRIVEN architecture.

STRICT RULES:
- DO NOT use or reference anything named "Infused"
- Keep support for: Factions, Protocol (ProtocolLib-style packet handling), but OPTIONAL + HOOK-BASED (soft depend)
- EVERYTHING must be configurable via YAML (NO hardcoded effects/items)
- Clean modular code, Java 17 compatible
- Use simple, readable structure

==================================================
CORE GOAL
==================================================
Create a plugin where:
- Custom items = "StarItems"
- Effects are NOT coded per item
- Effects are defined in YAML and dynamically loaded
- New items can be created ONLY by editing YAML (NO CODE CHANGE)

==================================================
PLUGIN STRUCTURE
==================================================
Generate clean package structure:

- main/
  - StarItemsPlugin (extends JavaPlugin)

- staritem/
  - StarItem (data class)
  - StarItemManager

- effects/
  - Effect (interface)
  - EffectContext
  - EffectFactory
  - registry/
  - impl/
    - PotionEffect
    - CommandEffect
    - DamageEffect
    - ParticleEffect
    - VelocityEffect

- listeners/
  - PlayerInteractListener
  - EntityHitListener

- hooks/
  - FactionsHook (optional)
  - ProtocolHook (optional)

- utils/
  - ItemBuilder
  - CooldownManager
  - ConfigLoader

==================================================
EFFECT SYSTEM (MOST IMPORTANT)
==================================================
Create a dynamic EFFECT ENGINE:

1. Effect interface:
2. EffectContext contains:
- Player
- Target (Entity)
- Location
- EventType (RIGHT_CLICK, HIT, PASSIVE)
- Item used

3. EffectFactory:
- Reads effects.yml
- Creates effect objects
- Stores in Map

4. NO hardcoded linking between item and effect logic

==================================================
YAML SYSTEM (MAIN FEATURE)
==================================================

Create these config files:

--------------------------------
config.yml
--------------------------------
settings:
  debug: false

cooldowns:
  enabled: true

--------------------------------
effects.yml
--------------------------------
effects:

  speed_boost:
    type: POTION
    trigger: RIGHT_CLICK
    target: SELF
    chance: 100
    cooldown: 10

    data:
      potion: SPEED
      duration: 200
      amplifier: 1

  lightning_strike:
    type: COMMAND
    trigger: HIT
    target: TARGET
    chance: 50

    data:
      command: "execute at %target% run summon lightning_bolt"

  knockback:
    type: VELOCITY
    trigger: HIT
    target: TARGET

    data:
      power: 1.5
      y: 0.5

--------------------------------
staritems.yml
--------------------------------
items:

  thunder_sword:
    material: DIAMOND_SWORD
    name: "&bThunder Sword"

    lore:
      - "&7Strike enemies with lightning"
      - "&7Chance based ability"

    triggers:
      - HIT

    cooldown: 5

    effects:
      - lightning_strike
      - knockback

  speed_wand:
    material: BLAZE_ROD
    name: "&aSpeed Wand"

    triggers:
      - RIGHT_CLICK

    effects:
      - speed_boost

==================================================
HOW SYSTEM WORKS (FLOW)
==================================================

1. Player interacts
2. Listener detects:
   - is this a StarItem?
3. Get item ID from NBT / PersistentDataContainer
4. Load item from StarItemManager
5. For each effect:
   - Check trigger match
   - Check cooldown
   - Check chance
6. Call:
   effect.apply(context)

==================================================
NBT / IDENTIFICATION
==================================================
Use PersistentDataContainer:
- key: "staritem_id"
- value: item ID

==================================================
COOLDOWN SYSTEM
==================================================
- Per player per item OR per effect
- Stored in HashMap>
- Configurable in YAML

==================================================
FACTIONS SUPPORT (OPTIONAL)
==================================================
- Hook if plugin exists
- Example:
  - Prevent effects in safezone
  - Check enemy before applying damage

==================================================
PROTOCOL SUPPORT (OPTIONAL)
==================================================
- Use ProtocolLib if present
- Example:
  - Custom animations
  - Fake effects
- Must NOT crash if missing

==================================================
ITEM BUILDER
==================================================
Create utility:
- setName
- setLore
- setNBT (important)

==================================================
ADDING NEW EFFECT (NO CODE CHANGE FOR USER)
==================================================
User should be able to:
1. Open effects.yml
2. Add:

  freeze:
    type: POTION
    trigger: HIT
    target: TARGET
    data:
      potion: SLOW
      duration: 100
      amplifier: 10

3. Add to item in staritems.yml

DONE ✅

==================================================
IMPORTANT IMPLEMENTATION NOTES
==================================================
- Use enums for:
  - EffectType
  - TriggerType
  - TargetType

- Use switch(type) inside factory

- All parsing safe (null checks)

- Use BukkitScheduler for delayed effects

==================================================
DELIVERABLE
==================================================
Generate:
- Full plugin code
- All classes
- All YAML files
- plugin.yml

plugin.yml:
name: StarItems
version: 1.0
main: your.package.StarItemsPlugin
api-version: 1.19
softdepend: [Factions, ProtocolLib]

==================================================
END
==================================================


Make it more structured, also change the prompt so that each staritem have seperate file and more configuration option like applied to, sound, particles, which item, off-on, lore, name, nbt tag, more feature
Kodari AI
KodariApr 11 at 10:51 am 27,802 (v2)

I’ll create a comprehensive, production-ready StarItems plugin with fully config-driven architecture and separate files for each item.

StarItems
A fully configurable custom items plugin with dynamic effect system. Create unlimited custom items through YAML without code changes. Features include: per-item config files, chance-based triggers, cooldown system, particle/sound effects, NBT tags, world/permission restrictions, optional Factions/ProtocolLib hooks, and extensible effect engine supporting potions, commands, damage, velocity, particles, and more.

All files created successfully! StarItems is now a fully configurable custom items plugin with:

Core Features:

  • Per-item YAML configs in staritems/ folder

  • Dynamic effect system (10+ effect types)

  • Extensive configuration options (worlds, permissions, gamemodes, NBT, particles, sounds)

  • Cooldown system (per-item and per-effect)

  • Chance-based triggers

  • Optional Factions/ProtocolLib hooks

Effect Types: Potion, Command, Damage, Velocity, Particle, Sound, Message, Heal

Trigger Types: RIGHT_CLICK, LEFT_CLICK, HIT, GET_HIT, KILL, DEATH

Commands: /staritems give/list/reload

Example Items Included: Thunder Sword, Speed Wand, Flame Bow

To add new items: Create a new YAML file in staritems/ folder. No code changes needed!

sqeeties

make it 1.21.1

Kodari AI
KodariApr 11 at 11:24 am 8,606 (v2)

I’ll read the project files to understand what needs updating for 1.21.1 compatibility.

I’ll update the plugin for 1.21.1 compatibility by updating the API version and dependencies.

Plugin updated for 1.21.1 with latest Spigot API, XSeries 11.3.0, ProtocolLib 5.3.0, Lombok 1.18.34, and Java 21 toolchain.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
IMPORTANT.txt
Code
39 2,332
src/main/java/com/staritems/StarItemsPlugin.java
package com.staritems;

import com.staritems.commands.StarItemsCommand;
import com.staritems.effects.EffectFactory;
import com.staritems.effects.registry.EffectRegistry;
import com.staritems.hooks.FactionsHook;
import com.staritems.hooks.ProtocolHook;
import com.staritems.listeners.EntityDamageListener;
import com.staritems.listeners.PlayerInteractListener;
import com.staritems.listeners.PlayerJoinListener;
import com.staritems.staritem.StarItemManager;
import com.staritems.utils.ConfigLoader;
import com.staritems.utils.CooldownManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class StarItemsPlugin extends JavaPlugin {
    private ConfigLoader configLoader;
    private StarItemManager starItemManager;
    private EffectRegistry effectRegistry;
    private EffectFactory effectFactory;
    private CooldownManager cooldownManager;
    private FactionsHook factionsHook;
    private ProtocolHook protocolHook;
    
    @Override
    public void onEnable() {
        getLogger().info("Starting StarItems...");
        
        this.configLoader = new ConfigLoader(this);
        this.starItemManager = new StarItemManager(this);
        this.effectRegistry = new EffectRegistry();
        this.effectFactory = new EffectFactory(this, effectRegistry);
        this.cooldownManager = new CooldownManager();
        this.factionsHook = new FactionsHook();
        this.protocolHook = new ProtocolHook();
        
        configLoader.loadConfigs();
        effectFactory.loadEffects();
        starItemManager.loadStarItems();
        
        registerListeners();
        registerCommands();
        
        checkHooks();
        
        getLogger().info("StarItems enabled! Loaded " + starItemManager.getAllStarItems().size() + " items");
        getLogger().info("Loaded " + effectRegistry.getAllEffects().size() + " effects");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("StarItems disabled!");
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new PlayerInteractListener(this), this);
        Bukkit.getPluginManager().registerEvents(new EntityDamageListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(this), this);
    }
    
    private void registerCommands() {
        StarItemsCommand command = new StarItemsCommand(this);
        getCommand("staritems").setExecutor(command);
        getCommand("staritems").setTabCompleter(command);
    }
    
    private void checkHooks() {
        if (factionsHook.isEnabled()) {
            getLogger().info("Factions hook enabled!");
        }
        
        if (protocolHook.isEnabled()) {
            getLogger().info("ProtocolLib hook enabled!");
        }
    }
}