Maitreya-DEV
📎 1 file 4,041 chars
📄
pasted-code-1773590869185.txt
txt 145 lines
▶
Create a **Minecraft Paper / Spigot plugin** called **DNA SMP** that adds a full survival gamemode where players can collect DNA from mobs and players, craft abilities, upgrade powers, and use a custom DNA system. The plugin must be optimized, configurable, and compatible with **1.20+**, support **multiplayer SMP servers**, and allow future expansion.

Core concept:
Every mob and player has DNA. When killed, they drop DNA fragments. Players can collect DNA, store it, combine it, and use it to unlock powers, abilities, and mutations. DNA should act like a currency + ability system combined.

DNA system:
Each mob has its own DNA type. Example DNA types: ZOMBIE_DNA, SKELETON_DNA, ENDERMAN_DNA, BLAZE_DNA, WITHER_DNA, WARDEN_DNA, PLAYER_DNA, CREEPER_DNA, SPIDER_DNA, DRAGON_DNA.
Each DNA has rarity: COMMON, RARE, EPIC, LEGENDARY, MYTHIC.
Drop chances must be configurable in config.yml.
Players should see a message when DNA drops.
DNA must be stored in a custom storage system (not only inventory, also database support optional).

DNA abilities:
Players can unlock abilities using DNA.
Each DNA gives different power.

Examples:
Zombie DNA → Strength effect
Skeleton DNA → Arrow damage boost
Enderman DNA → Teleport ability with cooldown
Blaze DNA → Fireball ability
Creeper DNA → Explosion ability
Spider DNA → Climb walls
Warden DNA → Strength + Slowness + Resistance
Wither DNA → Wither attack ability
Dragon DNA → Flight for short time
Player DNA → Steal random ability from killed player

Ability rules:
Abilities must have cooldown
Cooldown must be configurable
Abilities must not cause server lag
Abilities must work in PvP
Abilities must have permission nodes
Abilities must have enable/disable in config

DNA crafting system:
Add custom crafting INVENTORY GUI called DNA Lab.
Command: /dnalab
INVENTORY GUI size 54
Players can combine DNA to create stronger DNA.
Example:
5 Zombie DNA → 1 Rare Zombie DNA
5 Rare → 1 Epic
5 Epic → 1 Legendary
5 Legendary → 1 Mythic

DNA items:
DNA must be custom items with name, lore, and color.
Use custom model data support.
Items must not be easily duplicated.
Items must save correctly after restart.

Commands:
/dna → show player DNA
/dna give   
/dna remove   
/dnalab → open lab
/dna abilities → show abilities
/dna reload → reload config
/dna admin → admin menu

Permissions:
dnasmp.admin
dnasmp.use
dnasmp.give
dnasmp.reload
dnasmp.lab

INVENTORY GUI menus:
DNA storage INVENTORY GUI
DNA abilities INVENTORY GUI
DNA lab INVENTORY GUI
Admin INVENTORY GUI
Ability select INVENTORY GUI

Config.yml must include:
DNA drop chances
Ability cooldowns
Ability power
Enable / disable abilities
Max abilities per player
World blacklist
PvP enable toggle
Boss DNA chance
Player DNA chance

Boss DNA system:
Warden, Wither, Dragon must drop rare DNA.
Boss DNA gives strongest powers.
Boss DNA must be very rare.

Player DNA system:
When killing a player, chance to get PLAYER_DNA.
Player DNA can be used to copy ability.
Must have cooldown to prevent abuse.

Level system:
Players gain DNA XP when collecting DNA.
Higher level unlocks stronger abilities.
Level must be saved.
Level must show in /dna.

Scoreboard support:
Show DNA count
Show level
Show active ability
Show cooldown

Database support:
Use YAML by default
Optional MySQL support

Performance:
Must not lag with 50+ players
Use async tasks where needed
Avoid heavy repeating tasks

Events to detect:
Entity death
Player death
Ability use
Inventory click
INVENTORY GUI click
Player join
Player quit

Code requirements:
Use clean OOP structure
Use managers for DNA, abilities, INVENTORY GUI, config
Use listeners for events
Use enums for DNA types
Use cooldown manager
Use ability manager
Use storage manager

Output:
Full plugin source code
Main class
plugin.yml
config.yml
all classes
no explanations
only code structure and implementation.
Kodari AI
KodariMar 15 at 4:15 pm 76,469 (v2)

I’ll plan the full structure before writing:

  • Core: Main class, DNAType/DNARarity enums, DNAItem utility, PlayerData

  • Managers: StorageManager (YAML/MySQL), DNAManager, CooldownManager, LevelManager, ScoreboardManager, AbilityManager

  • Abilities: Interface + 10 implementations (Zombie, Skeleton, Enderman, Blaze, Creeper, Spider, Warden, Wither, Dragon, Player)

  • GUI Framework: InventoryHandler, InventoryButton, InventoryGUI, GUIManager, GUIListener + 5 GUI impls

  • Listeners: EntityDeath, PlayerDeath, AbilityUse, PlayerConnection

  • Commands: DNACommand, DNALabCommand

  • Resources: plugin.yml, config.yml

DNASmp
A full survival gamemode plugin where players collect DNA fragments from mobs and players. Features a DNA type/rarity system (Common to Mythic), 10 unique abilities (teleport, flight, fireball, climb, explosion, etc.), a DNA Lab crafting GUI, DNA storage GUI, level/XP progression, scoreboard integration, cooldown management, and YAML/MySQL storage support. Fully configurable drop chances, cooldowns, ability power, world blacklists, and PvP toggles.

Now I need to fix a naming conflict in ScoreboardManager where the imported Bukkit class conflicts with the class name:

The naming conflict needs to be fixed — the class is named ScoreboardManager and it imports org.bukkit.scoreboard.ScoreboardManager. I’ll use the fully qualified name.

Now let me read all the other files to verify they compile cleanly:

Now I have a clear picture. I need to:

  1. Fix ScoreboardManager naming conflict — remove the Bukkit import, use fully qualified name for the local variable

  2. Verify the remaining ability implementations are sound

I found two issues to fix:

  1. ScoreboardManager naming conflict — class named same as Bukkit’s ScoreboardManager

  2. SpiderAbility — broken task cancellation logic inside the runnable

All files are complete and consistent. Here’s a summary of what was built:


DNA SMP — Complete Plugin

Architecture

  • 10 DNA Types (Zombie → Dragon + Player) with 5 rarities (Common → Mythic), each with configurable drop chances per entity/rarity combination

  • 10 Abilities — each with unique mechanics: Enderman teleports to target block, Spider uses a repeating task for wall-climbing physics, Dragon grants temporary creative flight, Player steals an ability from a nearby target, Warden blinds all surrounding entities, Wither applies AoE wither effect, Creeper creates a configurable explosion, Blaze launches multiple guided fireballs, Skeleton fires a spread volley, Zombie grants Strength + Regen

  • DNA Lab GUI (54-slot) — input slots for combining 5×same-type→next rarity, or unlocking abilities (level-gated, rarity-gated)

  • 5 GUIs — Storage, Abilities, Lab, Admin Panel, Ability Select — all using the lazy-init InventoryGUI framework

  • Level/XP system — XP per DNA collected, automatic level-up with configurable threshold

  • Scoreboard — live updates every second showing level, XP, total DNA, active ability, cooldown

  • YAML storage — async saves per player to playerdata/<uuid>.yml

  • Commands — /dna [give|remove|abilities|select|storage|reload|admin|activate] with tab completion, /dnalab

  • Ability activation — sneak + right-click, checks permission, cooldown, world blacklist

Maitreya-DEV

Make a help gide by which admins can know which command to put

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
41 3,063
src/main/java/com/dnasmp/DNASmp.java
package com.dnasmp;

import com.dnasmp.ability.AbilityManager;
import com.dnasmp.commands.DNACommand;
import com.dnasmp.commands.DNALabCommand;
import com.dnasmp.inventory.gui.GUIListener;
import com.dnasmp.inventory.gui.GUIManager;
import com.dnasmp.listeners.AbilityUseListener;
import com.dnasmp.listeners.EntityDeathListener;
import com.dnasmp.listeners.PlayerConnectionListener;
import com.dnasmp.listeners.PlayerDeathListener;
import com.dnasmp.managers.CooldownManager;
import com.dnasmp.managers.DNAManager;
import com.dnasmp.managers.LevelManager;
import com.dnasmp.managers.ScoreboardManager;
import com.dnasmp.managers.StorageManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class DNASmp extends JavaPlugin {

    @Getter private static DNASmp instance;
    @Getter private StorageManager storageManager;
    @Getter private DNAManager dnaManager;
    @Getter private AbilityManager abilityManager;
    @Getter private CooldownManager cooldownManager;
    @Getter private LevelManager levelManager;
    @Getter private ScoreboardManager scoreboardManager;
    @Getter private GUIManager guiManager;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();

        this.storageManager = new StorageManager(this);
        this.storageManager.init();

        this.dnaManager = new DNAManager(this);
        this.abilityManager = new AbilityManager(this);
        this.cooldownManager = new CooldownManager();
        this.levelManager = new LevelManager(this);
        this.scoreboardManager = new ScoreboardManager(this);
        this.guiManager = new GUIManager();

        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new EntityDeathListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerDeathListener(this), this);
        Bukkit.getPluginManager().registerEvents(new AbilityUseListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerConnectionListener(this), this);

        DNACommand dnaCommand = new DNACommand(this);
        getCommand("dna").setExecutor(dnaCommand);
        getCommand("dna").setTabCompleter(dnaCommand);
        getCommand("dnalab").setExecutor(new DNALabCommand(this));

        scoreboardManager.startUpdating();
        getLogger().info("DNASmp enabled successfully.");
    }

    @Override
    public void onDisable() {
        if (storageManager != null) {
            storageManager.saveAll();
        }
        if (scoreboardManager != null) {
            scoreboardManager.stopUpdating();
        }
        getLogger().info("DNASmp disabled.");
    }
}