deadly_xplayz

💠 TECHNICAL SPECIFICATION: SOULBOUND SMP PLUGIN Developer Note: This plugin requires managing custom player data (UUID-based), handling custom GUIs, task scheduling (Runnables) for rituals, and specific event cancellations.

  1. Data Management & Storage

Database/Storage: Use YAML (data.yml) or SQLite to store player data mapped by UUID.

Required Variables per UUID: * souls (Integer, Default: 3) isJailed (Boolean, Default: false) boundSoul (String: "Echo", "Inferno", "Astral", "None") relicCooldown (Long, for 30-minute ability cooldowns)

  1. Core Mechanic: Lifesteal & Souls

Health Scaling: 1 Soul = 2 Health Points (1 Heart). Base health at 0 souls is 14 HP (7 Hearts). Formula: MaxHealth = 14 + (Souls * 2). Adjust player's GENERIC_MAX_HEALTH attribute.

PlayerDeathEvent Handling:

PVP Death: If killer is a player: killer gets +1 soul, victim gets -1 soul.

PVE/Natural Death: victim gets -1 soul.

Soul Fragment Drop: On any death, spawn a custom item drop at the victim's location: an Ender Eye with Custom Model Data/NBT Tag (Name: "&b&lSoul Fragment").

Elimination Check: If victim souls drop to 0, toggle isJailed = true.

  1. The Jail System

When isJailed is true, the plugin must strictly restrict the player:

Teleport: Force teleport to a predefined jail_spawn location.

Event Cancellations: Listen to and cancel the following events for jailed players:

BlockBreakEvent & BlockPlaceEvent EntityDamageEvent & EntityDamageByEntityEvent InventoryClickEvent & PlayerInteractEvent AsyncPlayerChatEvent (Jailed players cannot send public chat).

GameMode: Force set to GameMode.ADVENTURE.

  1. INVENTORY GUI Crafting System (The Forge)

Command: /soulbound recipe opens a custom 54-slot Chest Inventory (InventoryCrafting logic).

Event: Handle InventoryClickEvent to prevent item stealing.

Crafting Logic: Check if the player has specific items in their personal inventory when they click the "Forge" button in the INVENTORY GUI.

Cost for Echo: 3 Fragments + 6 Enchanted Golden Apples.

Cost for Inferno: 3 Fragments + 6 Netherite Blocks.

Cost for Astral: 3 Fragments + 6 Beacons.

Cost for Revive Crystal: 3 Fragments + 6 Totems of Undying.

  1. The Awakening Ritual (Task Scheduling)

When a player successfully buys a God Soul from the Forge, trigger a 3-minute survival sequence.

BukkitRunnable: Start a task that runs every 20 ticks (1 second) for 180 iterations.

World Manipulation: Set world.setStorm(true).

Action Bar/Titles: Send a countdown title 180s... 179s... to the player.

Mob Spawning: Use Math.floorMod(tick, 10) == 0 (every 10 seconds) to spawn 3 Zombies and 2 Skeletons at the player's location. Apply PotionEffectType.SPEED to the mobs. Strike lightning world.strikeLightningEffect(location).

Fail Conditions: If PlayerQuitEvent or PlayerDeathEvent triggers for the ritualist, cancel() the runnable and broadcast failure. Items are lost.

Success Condition: At iteration 180, clear the weather, give the player the God Relic (Custom NBT Item), unique God Weapons (e.g., Mace with specific enchants), and update their boundSoul variable. Lock this specific soul globally so no one else can craft it.

  1. God Relics & Passive Abilities

Handle EntityDamageByEntityEvent to implement passive powers:

Echo of Gaia (Tank):

Passive: If victim has Echo, attacker.damage(event.getDamage() * 0.3). (Reflects 30% damage).

Active (Right-Click Cooldown): Applies Resistance 4 and Absorption 5 for 5 minutes.

Inferno Soul (Damage):

Passive: If attacker has Inferno, victim.setFireTicks(100) (Ignite for 5 seconds).

Active (Right-Click Cooldown): Applies Strength 4 and Fire Resistance for 5 minutes.

Astral Gravity (Mobility):

Passive: If victim has Astral, Math.random() < 0.5 -> event.setCancelled(true). (50% Dodge chance).

Active (Right-Click Cooldown): Applies Speed 6, Jump Boost 5, and Invisibility for 5 minutes.

Items: Requires giving an Elytra and a Mace with high-level Density and Breach enchants upon ritual completion.

  1. The Revive System

Trigger: Player right-clicks the custom "Revive Crystal" item (PlayerInteractEvent).

Action: Cancel the interact event. Put the player in a revivingMode hashmap. Send a title asking for the target's name.

Chat Intercept: Listen to AsyncPlayerChatEvent. If the player is in the hashmap, cancel the chat message.

Read the message as a String (Target Player Name).

Check if Target is in the database and isJailed == true.

If valid: Set Target souls = 3, isJailed = false, GameMode = SURVIVAL, teleport Target to main spawn.

Remove 1 Revive Crystal from the reviver's inventory and remove them from the hashmap.

  1. Start/Stop Mechanics & Commands

Global State: Maintain a boolean isGameStarted.

Admin Commands: /soulbound start: Sets isGameStarted = true. Loops through all online players (who aren't jailed) and sets them to SURVIVAL. /soulbound stop: Sets isGameStarted = false. Sets all players to ADVENTURE. /soulbound reset <player>: Force resets a player's souls to 3 and removes them from jail.

Kodari AI
KodariApr 23 at 7:36 am 56,942 (v2)
SoulboundSMP
A feature-rich SMP plugin built around a soul-based lifesteal system. Players start with 3 souls (each worth 1 heart), steal souls on PvP kills, and lose them on death. Reaching 0 souls sends you to jail. Includes a GUI Forge to craft God Soul bindings (Echo, Inferno, Astral) and Revive Crystals. Each God Soul offers passive combat abilities and a 30-minute active relic skill. God Souls require surviving a 3-minute ritual with wave-based mob spawns. A revive system lets players free jailed allies using Revive Crystals.
  • 22 files total: main plugin, data layer, 4 managers, 4 listeners, GUI framework + ForgeGUI, command, and resources

  • All soul/health changes routed through SoulManager, jail enforcement via JailListener, ritual scheduling in RitualManager

  • XSeries used for all Materials, Sounds, Enchantments, Potions, and Attributes — no raw Bukkit enums

All 22 files created. Here’s a summary of what was built:

Core Systems:

  • DataManager — YAML-backed per-UUID storage with in-memory cache for souls, jail state, bound soul, and relic cooldown

  • SoulManager — Health scaling via XAttribute, soul add/remove with auto-jail trigger at 0 souls

  • JailManager — Sets jailed flag; JailListener enforces it on join/respawn, cancels all interaction events

  • RitualManager — BukkitRunnable-based 3-minute survival ritual with mob waves every 10s, on success grants God Relic + God Mace (+ Elytra for Astral), globally locks each soul type

  • ReviveManager — Chat interception flow via AsyncPlayerChatEvent to target a jailed player by name and consume a Revive Crystal

Combat & Relics (RelicListener):

  • Echo passive: 30% damage reflect; active: Resistance IV + Absorption V

  • Inferno passive: ignites attackers; active: Strength IV + Fire Resistance

  • Astral passive: 50% dodge; active: Speed VI + Jump V + Invisibility

  • All actives gate-checked with a 30-minute millisecond cooldown stored in PlayerData

Forge GUI: 54-slot inventory with dynamic lore showing live ingredient counts, global soul lock status, and per-recipe forge buttons for all 3 God Souls and Revive Crystal

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
22 1,607
src/main/java/com/soulbound/SoulboundPlugin.java
package com.soulbound;

import com.soulbound.commands.SoulboundCommand;
import com.soulbound.data.DataManager;
import com.soulbound.inventory.gui.GUIListener;
import com.soulbound.inventory.gui.GUIManager;
import com.soulbound.listeners.DeathListener;
import com.soulbound.listeners.JailListener;
import com.soulbound.listeners.RelicListener;
import com.soulbound.listeners.ReviveListener;
import com.soulbound.managers.JailManager;
import com.soulbound.managers.ReviveManager;
import com.soulbound.managers.RitualManager;
import com.soulbound.managers.SoulManager;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class SoulboundPlugin extends JavaPlugin {

    private DataManager dataManager;
    private SoulManager soulManager;
    private JailManager jailManager;
    private RitualManager ritualManager;
    private ReviveManager reviveManager;
    private GUIManager guiManager;

    @Setter
    private boolean gameStarted = false;

    private Location jailSpawn;
    private Location mainSpawn;

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

        this.dataManager = new DataManager(this);
        this.soulManager = new SoulManager(this);
        this.jailManager = new JailManager(this);
        this.ritualManager = new RitualManager(this);
        this.reviveManager = new ReviveManager(this);
        this.guiManager = new GUIManager();

        loadSpawns();

        if (getCommand("soulbound") != null) {
            getCommand("soulbound").setExecutor(new SoulboundCommand(this));
        }

        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new DeathListener(this), this);
        Bukkit.getPluginManager().registerEvents(new JailListener(this), this);
        Bukkit.getPluginManager().registerEvents(new RelicListener(this), this);
        Bukkit.getPluginManager().registerEvents(new ReviveListener(this), this);

        getLogger().info("SoulboundSMP has been enabled successfully!");
    }

    @Override
    public void onDisable() {
        if (dataManager != null) {
            dataManager.saveAll();
        }
        getLogger().info("SoulboundSMP has been disabled. All data saved.");
    }

    private void loadSpawns() {
        this.jailSpawn = loadLocation("jail_spawn");
        this.mainSpawn = loadLocation("main_spawn");
    }

    private Location loadLocation(String path) {
        ConfigurationSection sec = getConfig().getConfigurationSection(path);
        if (sec == null) return null;
        String worldName = sec.getString("world", "world");
        World world = Bukkit.getWorld(worldName);
        double x = sec.getDouble("x", 0.0);
        double y = sec.getDouble("y", 64.0);
        double z = sec.getDouble("z", 0.0);
        if (world == null) {
            getLogger().warning("Could not find world '" + worldName + "' for location '" + path + "'. Using default world.");
            world = Bukkit.getWorlds().isEmpty() ? null : Bukkit.getWorlds().get(0);
        }
        return world != null ? new Location(world, x, y, z) : null;
    }
}