Y
📎 1 file 5,580 chars
📄
pasted-code-1776522716299.txt
txt 356 lines
▶
Create a complete, production-ready Minecraft SMP plugin using Java and the Spigot/Paper API (latest version). The plugin must be cleanly structured, optimized, and suitable for a real multiplayer server.

Plugin Name: GenomeSMP

---

# 🔥 CORE IDEA

This plugin introduces a "DNA Power System" where players gain abilities from mobs. Players collect DNA fragments, craft DNA using a machine (DNA Maker), equip DNA, and use abilities in PvP.

The system must be simple to use but deep in gameplay.

---

# 🎬 1. SMP START SYSTEM

Command: /smpstart

Behavior:

* Trigger a cinematic start event for all online players:

  * Apply levitation (3–5 seconds)
  * Spawn fireworks around players
  * Play sound effects
  * Show title: "GENOME ACTIVATING..."
* After the animation:

  * Give each player 1 random starter DNA (from basic pool)

Ensure:

* Runs safely for multiple players
* No lag spikes
* Uses scheduler tasks properly

---

# 🧬 2. DNA SYSTEM

Each player can have:

* 1 Active DNA (main ability)
* 1 Passive DNA (optional passive effect)
* Only 1 Exclusive DNA allowed

DNA must be stored per player using UUID.

Use a PlayerDNA class:

* activeDNA
* passiveDNA
* exclusiveDNA
* cooldowns map

Persist data on player quit and server restart.

---

# 🧪 3. DNA ITEM SYSTEM

Use custom items with NBT/PersistentDataContainer.

Normal DNA:

* Base item: Glass Bottle
* Name: " DNA Vial"

Exclusive DNA:

* Base item: Nether Star
* Name: " Genome Core"

Each DNA item must include:

* Custom display name (colored)
* Lore (ability description, instability level)
* Hidden tag:

  * dna_type (string)
  * dna_level (normal/exclusive)

Prevent stacking if needed.

---

# 🎒 4. DNA EQUIP SYSTEM

Mechanics:

* Right-click DNA item to equip
* Do NOT consume item (or optionally consume, configurable)
* Save equipped DNA in player data

Rules:

* Max 2 DNA total
* Only 1 exclusive DNA

Add command:
/dna

* Opens INVENTORY GUI:

  * Slot for Active DNA
  * Slot for Passive DNA
  * Player inventory shows stored DNA

INVENTORY GUI must:

* Be clickable
* Allow swapping DNA
* Prevent invalid placements

---

# ⚔️ 5. ABILITY SYSTEM

Trigger:

* Right Click (main ability)
* Shift + Right Click (secondary ability if available)

Use PlayerInteractEvent.

System:

* Detect player’s equipped DNA
* Route to AbilityManager

---

## Example Abilities:

Creeper DNA:

* Explosion at player location (controlled power, no block damage optional)

Enderman DNA:

* Short-range teleport (safe teleport)

Blaze DNA:

* Fireball projectile

---

# 👑 6. EXCLUSIVE DNA ABILITIES

Wither DNA:

* Shoot 3 wither skulls
* Apply wither effect
* Slight self-damage risk

Dragon DNA:

* Dash forward with velocity
* Knockback enemies
* Secondary: Dragon breath area cloud

Warden DNA:

* Sonic boom (line damage)
* Secondary: ground smash AoE

---

# ⏱️ 7. COOLDOWN SYSTEM

Requirements:

* Track cooldown per player per ability
* Prevent usage during cooldown
* Show cooldown via Action Bar

Structure:
Map>

---

# 🧪 8. DNA FRAGMENT SYSTEM

On mob death:

* Chance-based drop of DNA fragments

Examples:

* Creeper → Creeper Fragment
* Enderman → End Fragment

Fragments:

* Custom items with NBT tag: fragment_type

Drop rates must be configurable.

---

# ⚙️ 9. DNA MAKER (CUSTOM MACHINE INVENTORY GUI)

Create a custom inventory INVENTORY GUI:

Slots:

* Input: fragments
* Fuel: Blaze Powder (main), Redstone (secondary)
* Output: DNA

Fuel System:

* Blaze Powder = high energy
* Redstone = low energy

Logic:

* Validate recipe
* Check energy
* Process crafting

---

## Crafting Behavior:

* Normal DNA: high success rate
* Exclusive DNA: lower success rate

Failure:

* Destroy items OR
* Create "Glitched DNA" (negative effect item)

---

# 💀 10. RISK / INSTABILITY SYSTEM

Add a system where:

* Frequent ability use increases instability
* Effects:

  * Random damage
  * Ability failure
  * Visual glitches

Optional but preferred:

* Instability resets over time

---

# ⚔️ 11. PVP SYSTEM

On player kill:

* Chance to steal one DNA from victim

On death:

* Player loses one equipped DNA

Ensure:

* No duplication bugs
* Safe inventory handling

---

# 💾 12. DATA STORAGE

Store:

* Equipped DNA
* Cooldowns

Use:

* YAML OR SQLite (prefer modular system)

Auto-save:

* On player quit
* On server shutdown

---

# 🧱 13. PROJECT STRUCTURE

Use clean OOP design:

Packages:

* commands
* dna
* abilities
* INVENTORY GUI
* listeners
* utils

Classes:

* Main
* DNAItemManager
* DNAEquipManager
* AbilityManager
* CooldownManager
* DNAMakerGUI
* FragmentListener
* PvPListener

---

# ⚡ 14. PERFORMANCE REQUIREMENTS

* Avoid heavy loops on main thread
* Use scheduler tasks for delays
* Minimize entity spam
* Optimize particle usage

---

# 🧾 15. CONFIGURATION

Create config.yml:

* Drop rates
* Cooldowns
* Damage values
* Fuel values

---

# 📦 16. OUTPUT REQUIREMENTS

Provide:

1. Full Java source code (multiple classes)
2. plugin.yml
3. config.yml
4. Clear setup instructions
5. How to compile (Maven/Gradle)
6. Testing steps

---

# 🎯 FINAL GOAL

The plugin must be:

* Fully functional
* Smooth for multiplayer SMP
* Easy to understand for players
* Optimized and bug-free
Kodari AI
KodariApr 18 at 2:36 pm 23,962 (v2)

I’ll create a complete, production-ready DNA-based SMP plugin with abilities, GUIs, and PvP mechanics.

GenomeSMP
A DNA-based ability system where players collect DNA fragments from mobs, craft DNA items using a custom DNA Maker machine, and equip active and passive abilities for combat. Features include cinematic server start event, inventory GUI management, cooldown systems, instability mechanics, DNA stealing on PvP kills, and configurable drop rates. Supports both normal and exclusive DNA with unique abilities from Creeper, Enderman, Blaze, Wither, Dragon, and Warden.

Complete GenomeSMP Plugin Created

Features implemented:

  • ✅ Cinematic /smpstart with levitation, fireworks, and starter DNA

  • ✅ DNA item system using PersistentDataContainer (Normal & Exclusive)

  • ✅ Fragment drops from mobs with configurable rates

  • ✅ DNA Maker GUI for crafting (with fuel system and success rates)

  • ✅ DNA Management GUI (/dna command)

  • ✅ DNA equipping system (right-click, max 2 DNA, 1 exclusive limit)

  • ✅ 6 unique abilities: Creeper, Enderman, Blaze, Wither, Dragon, Warden

  • ✅ Cooldown system with action bar messages

  • ✅ PvP mechanics: DNA stealing on kill, DNA drop on death

  • ✅ YAML data persistence for player DNA

  • ✅ Full XSeries integration (no direct Material/Sound usage)

  • ✅ Configurable drop rates, cooldowns, and ability values

To compile: ./gradlew build (output in build/libs/)

Commands:

  • /smpstart - Trigger DNA activation event (admin)

  • /dna - Open DNA management GUI

Permissions:

  • genomesmp.admin - Access to /smpstart

  • genomesmp.use - Use DNA system (default: true)

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
34 1,978
src/main/java/com/genome/smp/GenomeSMP.java
package com.genome.smp;

import com.genome.smp.commands.DNACommand;
import com.genome.smp.commands.SMPStartCommand;
import com.genome.smp.inventory.gui.GUIListener;
import com.genome.smp.inventory.gui.GUIManager;
import com.genome.smp.listeners.AbilityTriggerListener;
import com.genome.smp.listeners.DNAEquipListener;
import com.genome.smp.listeners.FragmentDropListener;
import com.genome.smp.listeners.PvPListener;
import com.genome.smp.managers.AbilityManager;
import com.genome.smp.managers.CooldownManager;
import com.genome.smp.managers.DNADataManager;
import com.genome.smp.managers.DNAEquipManager;
import com.genome.smp.managers.DNAItemManager;
import com.genome.smp.managers.FragmentManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class GenomeSMP extends JavaPlugin {
    
    private DNADataManager dnaDataManager;
    private DNAItemManager dnaItemManager;
    private DNAEquipManager dnaEquipManager;
    private AbilityManager abilityManager;
    private CooldownManager cooldownManager;
    private FragmentManager fragmentManager;
    private GUIManager guiManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.dnaDataManager = new DNADataManager(this);
        this.dnaItemManager = new DNAItemManager(this);
        this.cooldownManager = new CooldownManager(this);
        this.dnaEquipManager = new DNAEquipManager(this);
        this.abilityManager = new AbilityManager(this);
        this.fragmentManager = new FragmentManager(this);
        this.guiManager = new GUIManager();
        
        registerListeners();
        registerCommands();
        
        getLogger().info("GenomeSMP enabled successfully!");
    }
    
    @Override
    public void onDisable() {
        this.dnaDataManager.saveAll();
        getLogger().info("GenomeSMP disabled!");
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new DNAEquipListener(this), this);
        Bukkit.getPluginManager().registerEvents(new AbilityTriggerListener(this), this);
        Bukkit.getPluginManager().registerEvents(new FragmentDropListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PvPListener(this), this);
    }
    
    private void registerCommands() {
        getCommand("smpstart").setExecutor(new SMPStartCommand(this));
        getCommand("dna").setExecutor(new DNACommand(this));
    }
}