orginaeron
📎 1 file 1,103 chars
đź“„
pasted-code-1787151419089.txt
txt 20 lines
â–¶
Create a Minecraft plugin for Paper/Spigot version 1.26 to 1.26.2.

When a player joins or respawns, give them one special custom sword that supports custom texture using CustomModelData.

Features of the sword:
- Players cannot drop this sword
- Players cannot put this sword in any chest, ender chest, barrel, shulker box, hopper or any other container
- Players cannot move this sword to offhand
- The sword is bound to the player like their heart/soul

Soul System:
- If a player dies and another player picks up their sword, then when the original owner respawns they become completely stuck (cannot move, cannot break/place blocks, cannot attack, cannot open inventory)
- Show title "SOUL LOCKED" and keep showing actionbar message that they need to get their sword back
- Only when the original owner gets their sword back, the lock is removed and they can play normally again

Add a custom right-click power to the sword.
Make the sword unbreakable.
Use PersistentDataContainer to bind the sword to the owner.
Add config.yml for messages and settings.
Set api-version to 1.26.
Kodari AI
KodariAug 19 at 3:00 pm 2
SoulBoundSword
A Minecraft Paper plugin that grants players a custom unbreakable sword with CustomModelData texture on join or respawn. The sword is soul-bound via PersistentDataContainer, preventing drops, container storage, and offhand movement. If another player steals the sword and the owner dies, the owner becomes fully locked—unable to move, interact, or open inventories—with a persistent "SOUL LOCKED" title and actionbar prompt until retrieving their weapon. Includes configurable messages and settings via config.yml, plus a custom right-click ability.
  1. Create the Gradle project and plugin metadata for Paper/Spigot 1.26.

  2. Add the soul-bound sword manager with PDC ownership, texture metadata, and unbreakable settings.

  3. Add soul-lock enforcement, inventory/container protection, pickup recovery, and actionbar/title feedback.

  4. Add the configurable right-click power and default configuration.

  1. Created the Gradle Paper/Spigot plugin project with plugin.yml, config.yml, and api-version: 1.26.

  2. Added a PDC-bound, unbreakable custom-model-data Soul Sword with configurable material, name, lore, and owner UUID.

  3. Added protection against dropping, container storage, hopper movement, offhand swapping, inventory manipulation, and locked-player interaction.

  4. Added soul-lock behavior after death when the sword is recovered by another player, including title, actionbar, movement, combat, block, and inventory restrictions.

  5. Added configurable right-click soul-wave power with radius damage, knockback, particles, sound, and cooldown.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
10 568
src/main/java/com/kodari/soulsword/SoulSwordPlugin.java
package com.kodari.soulsword;

import com.kodari.soulsword.listener.SoulSwordListener;
import com.kodari.soulsword.soul.SoulLockManager;
import com.kodari.soulsword.sword.SoulSwordManager;
import com.kodari.soulsword.sword.SwordPower;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class SoulSwordPlugin extends JavaPlugin {
    private SoulSwordManager swordManager;
    private SoulLockManager lockManager;
    private SwordPower swordPower;

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

        this.swordManager = new SoulSwordManager(this);
        this.lockManager = new SoulLockManager(this);
        this.swordPower = new SwordPower(this);

        Bukkit.getPluginManager().registerEvents(
                new SoulSwordListener(this, swordManager, lockManager, swordPower), this);
    }

    @Override
    public void onDisable() {
        if (lockManager != null) {
            lockManager.shutdown();
        }
    }
}