Uzii on fire
📎 1 file 4,838 chars
📄
pasted-code-1790412414707.txt
txt 134 lines
▶
# Spider Sword — Custom Minecraft Weapon

Create a custom weapon called **Spider Sword** for **Paper 1.21.11**.

## Sword Name

**Spider Sword**

The sword must be a completely custom weapon. Its abilities must ONLY work when the player is holding the actual Spider Sword. A normal Diamond Sword must not receive any of these abilities.

## Enchantments & Properties

The Spider Sword must have:

* **Sharpness VII**
* **Fire Aspect VII**
* **Unbreakable**
* No durability loss
* No cooldown on any ability

The sword should have a unique custom identity and must not behave like an ordinary Diamond Sword when using its special abilities.

## Ability 1 — Soul Capture

Whenever the player holding the **Spider Sword kills another player**, the sword captures that player's soul.

### Effect:

* The killed player is automatically **banned from the server for exactly 24 hours**.
* This must be a temporary ban, not a permanent ban.
* After exactly 24 hours, the player is automatically unbanned.
* The victim should not need to be manually unbanned.
* The system must store the ban expiration time so the timer continues correctly even if the server restarts.
* The temporary ban must survive server restarts.
* If the server restarts while someone is soul-captured, their remaining ban time must continue from where it left off.
* The player must not be able to bypass the temporary ban simply by reconnecting.

### Soul Capture Effects:

When the kill happens:

* Play a dark/magical soul-capture particle effect around the victim.
* Play an appropriate ominous/soul sound.
* Display a clear message to the killer indicating that the victim's soul has been captured.
* Display a clear message to the victim explaining that their soul was captured and showing the remaining ban duration.

Example:

**Killer:**

> SOUL CAPTURED!
> You have captured the soul of  for 24 hours.

**Victim:**

> Your soul has been captured by .
> You are banned for 24 hours.

Do not require the player to execute any command.

## Ability 2 — 10 Block Reach

The Spider Sword gives the holder an extended attack range.

The player must be able to hit and damage another player from up to **10 blocks away**.

### Requirements:

* Maximum attack range: **10 blocks**
* The attack must deal normal Spider Sword melee damage plus its enchantments/effects.
* It must work by looking directly at the target.
* It should feel like a legitimate extended melee attack rather than a projectile.
* No cooldown.
* No special command required.
* Normal swords must retain normal Minecraft reach.
* The extended reach must ONLY activate while the Spider Sword is being used.

### Targeting:

* The player should be able to aim at a target within the 10-block range.
* Do not require the target to be extremely close.
* Prevent hitting targets through solid blocks.
* Use proper line-of-sight/raycast checking.
* Do not allow the sword to hit multiple unintended players at once.

## Sword Description / Lore

Give the Spider Sword an impressive custom lore:

**Spider Sword**

> §7Forged with the power of a cursed spider.
> §7Every soul it claims becomes its prisoner.
>
> §c✦ Soul Capture
> §fKill a player to capture their soul.
> §7Their soul remains imprisoned for §c24 hours§7.
>
> §5✦ Spider's Reach
> §fStrike enemies from up to §c10 blocks§f away.
>
> §6Sharpness VII
> §6Fire Aspect VII
> §6Unbreakable

The exact colors/effects can be adjusted to make the sword look dark, dangerous, and rare.

## Important Restrictions

1. **No cooldowns whatsoever.**
2. **No commands required from players.**
3. Abilities must work automatically.
4. Abilities must only work with the genuine Spider Sword.
5. Renaming a normal Diamond Sword to "Spider Sword" must NOT activate the abilities.
6. Store a unique identifier/PersistentDataContainer tag on the sword.
7. The 24-hour soul ban must persist through server restarts.
8. The temporary ban must automatically expire after exactly 24 hours.
9. Do not permanently ban anyone.
10. Do not affect normal Diamond Swords.
11. The plugin must handle server restarts and player reconnects safely.
12. Avoid console errors and duplicated ban timers.
13. All important values should preferably be configurable through the plugin configuration.
14. The plugin should work on **Paper 1.21.11**.

## Core Goal

The final result should feel like a rare, extremely powerful **Spider Sword** with two unique abilities:

**1. Soul Capture** → Kill a player → their soul is captured → they receive an automatic 24-hour temporary server ban.

**2. Spider's Reach** → Attack players from up to 10 blocks away.

There should be **no cooldown and no command required** for either ability.
Kodari AI
KodariSep 26 at 8:48 am 1
SpiderSwordSoul
A custom Paper 1.21.11 weapon plugin that creates the Spider Sword with two unique abilities. Soul Capture automatically bans killed players for exactly 24 hours with persistent storage that survives server restarts, complete with dark particle effects and ominous sounds. Spider's Reach enables melee attacks from up to 10 blocks away using raycast line-of-sight targeting. The sword features Sharpness VII, Fire Aspect VII, Unbreakable, custom lore, and a PersistentDataContainer identifier ensuring abilities only activate with the genuine item. All values are configurable with no cooldowns or commands required.
  1. Set up the Paper 1.21.11 plugin and configurable, PDC-tagged Spider Sword.

  2. Add custom reach combat with line-of-sight checks and normal attacks suppressed to prevent double damage.

  3. Persist soul captures, enforce timed bans across restarts, and add the admin sword-give command.

Created the Paper 1.21.11 SpiderSword plugin with a uniquely PDC-tagged, unbreakable sword, configurable enchantments and reach, and custom melee targeting that checks line of sight. Spider Sword attacks on players use the extended reach; ordinary attacks on mobs remain intact.

Soul captures create expiring bans and persist their expiry across restarts. Active bans are checked on login, and the ban duration, reach, enchantments, effects, and messages are configurable.

Give the sword with /spidersword give <player>; the command requires spidersword.admin (operators by default).

Uzii on fire
📎 1 file 9,829 chars
📄
pasted-code-1790417506549.txt
txt 383 lines
▶
# Spider Sword — Ritual Crafting + Void Protection Update

Update the existing **SpiderSword** plugin for **Paper 1.21.11**.

Do NOT remove or break any existing Spider Sword mechanics.

## 1. Spider Sword Crafting Recipe

Add the crafting recipe shown in the provided reference image.

The recipe must remain exactly as provided:

* Use the exact ingredient types and quantities shown in the recipe screenshot.
* The final result must be the existing **Spider Sword**.
* Do not replace the recipe with a different recipe.
* The recipe must be a normal craftable recipe.

The Spider Sword must still use its existing unique internal identifier/PersistentDataContainer so that renaming a normal sword cannot create a fake Spider Sword.

---

# 2. Ritual Starts Automatically When Spider Sword Is Crafted

When a player successfully crafts the Spider Sword using the recipe above:

**DO NOT immediately simply place the finished sword into the player's inventory.**

Instead, start a special **Spider Sword Ritual** on top of the crafting table where the sword was crafted.

The ritual should visually resemble the provided reference image.

## Ritual Location

The crafting table used to craft the Spider Sword becomes the ritual center.

The ritual happens directly **above the crafting table**.

The ritual must NOT require another command.

The player simply crafts the Spider Sword and the ritual automatically begins.

---

# 3. Ritual Visual Design

Create a dramatic magical ritual animation.

The overall appearance should resemble the provided reference:

* Crafting table at the center
* Spider Sword / ritual core above the crafting table
* Multiple ingredients floating around the center
* Floating items should rotate around the ritual
* Dark/magical particles
* Glowing particles
* Smoke/energy effects
* Occasional lightning-like visual effects without actually damaging players
* Enchanting/magical sounds
* Items should smoothly orbit around the center
* The ritual should feel rare and powerful

The floating ingredients should visually correspond to the ingredients used in the Spider Sword recipe.

Do not make the animation look like random particles. It should clearly look like a structured magical crafting ritual.

---

# 4. Ritual Animation Sequence

Use a multi-stage animation.

### Stage 1 — Activation

Immediately after crafting:

* The crafting table becomes the ritual center.
* Play a magical activation sound.
* Spawn particles around the crafting table.
* The recipe ingredients begin appearing/floating around the center.

### Stage 2 — Floating Ingredients

The ingredients float above the crafting table.

They should:

* Orbit around the center.
* Slowly rotate.
* Move slightly up and down.
* Have particle trails.
* Glow/emit appropriate particles.

The arrangement should resemble the provided ritual screenshot.

### Stage 3 — Energy Formation

Gradually increase the particle intensity.

Create an energy effect between the floating ingredients and the center.

Use:

* Enchant particles
* Soul-like particles
* Portal-like particles
* Smoke
* End-rod/glow effects
* Occasional dark energy bursts

Do not cause damage to nearby players.

### Stage 4 — Spider Sword Formation

Near the end of the ritual:

* Pull the floating ingredients toward the center.
* Create a strong particle burst.
* Make the Spider Sword appear at the center above the crafting table.
* Play a powerful completion sound.
* Create a final particle explosion.

The final Spider Sword must be the actual custom Spider Sword item with its unique internal identifier.

---

# 5. Crafting Result / Inventory Handling

The sword must not be duplicated.

When the ritual begins:

* Consume the recipe ingredients exactly once.
* Remove the normal crafting result.
* Start the ritual.
* After the ritual completes, give the Spider Sword to the player who performed the craft.

If the player's inventory is full:

* Do not delete the sword.
* Drop the completed Spider Sword safely at the ritual location.

If the server restarts during a ritual:

* The ritual must not create a duplicate Spider Sword.
* Safely cancel/recover the ritual state.
* Do not lose the ingredients or create duplicate items.

Only one Spider Sword should be produced for one successful craft.

---

# 6. Ritual Protection

While the ritual is active:

* Other players must not be able to steal/remove the ritual ingredients.
* Players must not be able to trigger another Spider Sword ritual from the same crafting table simultaneously.
* Prevent duplicate crafting from rapid clicks.
* The ritual should not permanently alter or destroy the crafting table.

When the ritual finishes, the crafting table remains normal.

---

# 7. VOID DEATH — SPIDER SWORD PROTECTION

Add a special protection system for the Spider Sword.

If a player dies because they fall into the **VOID** while they have the Spider Sword:

**The Spider Sword must NEVER be lost to the void.**

Do NOT allow the sword to disappear permanently.

Do NOT let it fall into the void and despawn.

Instead, automatically recover the Spider Sword.

---

# 8. Finding a Safe Block

When the player dies in the void:

1. Detect that the death was caused by VOID damage.
2. Detect whether the player had the Spider Sword.
3. Find the nearest suitable solid/non-air block around the player's last known location.
4. Place/drop the Spider Sword at that safe location.
5. The item must be safely above the block so it can be picked up normally.
6. Make sure the item cannot fall back into the void.

If the exact death location has no nearby block:

* Search outward for the nearest safe solid block.
* Use a reasonable search radius.
* Never place the sword in another dangerous void location.

The sword should remain safely recoverable.

---

# 9. Prevent Normal Void Item Loss

When this specific situation happens:

**Do not allow the Spider Sword to follow normal death-drop physics into the void.**

The Spider Sword must be removed from the normal death-drop process and manually spawned at the calculated safe location.

Other player items should behave normally.

Only the Spider Sword receives this special protection.

---

# 10. Locate Coordinates in Chat

When the Spider Sword is recovered after a void death, send a clear server chat message containing its exact coordinates.

Example:

§5§lSPIDER SWORD RECOVERED!

§fThe Spider Sword survived the void and was recovered at:

§dX: 125 §7| §dY: 64 §7| §dZ: -382

The coordinates must be the actual location where the Spider Sword was placed.

Optionally also include the world name.

Example:

§7World: world

This message should be visible in server chat so players can locate the sword.

---

# 11. Multiple Worlds

The void protection must work in:

* Overworld
* Nether
* End
* Any other loaded world

The plugin must use the correct world when calculating the recovery location.

The chat message must include the correct world name.

---

# 12. Existing Spider Sword Abilities MUST REMAIN

Do not remove or modify the existing abilities.

The Spider Sword must still have:

### Soul Capture

When the Spider Sword kills a player:

* Capture their soul.
* Automatically temporary-ban them for exactly 24 hours.
* Automatically unban them after 24 hours.
* Ban data must survive server restarts.

### Spider Reach

The holder can hit and damage players from up to:

**10 blocks**

No cooldown.

### Enchantments

Spider Sword:

* Sharpness VII
* Fire Aspect VII
* Unbreakable

No cooldowns.

---

# 13. Resource Pack Compatibility

The Spider Sword must continue using the existing custom resource-pack model/texture.

Do NOT change the Spider Sword's internal identifier in a way that breaks the current resource pack.

The sword should display its custom Spider Sword texture/model.

Its visible name can remain formatted/colorized, but the resource-pack identification must use the proper item-model/custom-data mechanism rather than relying only on the visible display name.

---

# 14. Important Technical Requirements

Paper version:

**1.21.11**

Use modern Paper/Bukkit APIs compatible with 1.21.11.

Do not use deprecated/unsafe NMS implementations unless absolutely necessary.

The ritual must be efficient:

* Do not create excessive entities.
* Do not spawn hundreds of permanent particles every tick.
* Clean up all scheduled tasks when the ritual ends.
* Clean up correctly if the player disconnects.
* Clean up correctly if the server shuts down.

Do not introduce any PlayerLoginEvent implementation that can cause:

`java.lang.IllegalStateException: void future`

The plugin must not interfere with Paper's modern login/reconfiguration system.

---

# Final Behavior

The complete flow should be:

**Player puts the exact recipe into the crafting table**

↓

**Player crafts Spider Sword**

↓

**Recipe ingredients are consumed**

↓

**Ritual immediately starts above that crafting table**

↓

**Ingredients float around the crafting table**

↓

**Magical particles + sounds + energy effects**

↓

**Spider Sword forms in the ritual**

↓

**Ritual completes**

↓

**Player receives the actual Spider Sword**

↓

Later, if the Spider Sword kills a player:

**Soul Capture → 24-hour temporary ban**

And if the Spider Sword holder falls into the void:

**Sword is automatically recovered at the nearest safe block**

↓

**Sword cannot be lost to the void**

↓

**Server chat announces the exact recovery coordinates.**
Kodari AI
KodariSep 26 at 10:12 am 1
  1. Check the existing sword and crafting setup; the referenced recipe image wasn’t attached, so I’ll preserve existing recipe details rather than guess ingredients.

  2. Add the craft ritual with safe ingredient/result handling.

  3. Add void-death recovery for the genuine Spider Sword.The project has no existing crafting recipe, and the referenced recipe image didn’t come through. I can’t safely choose ingredients or build the matching ritual without it. I’ll proceed with the independent void-recovery protection; please reattach the recipe image for the crafting update.

  • On void-caused deaths, remove only PDC-identified Spider Swords from normal drops.

  • Search nearby loaded terrain for a safe landing spot, then try world spawn; prevent the recovered item from falling or despawning.

  • Make recovery and its server-wide coordinate announcement configurable.

Added void recovery for genuine Spider Swords: on a void-caused death, matching swords are removed from normal drops and placed at a nearby safe location. If none is found, recovery falls back to world spawn; the server broadcasts the item’s coordinates and world. Recovery can be configured in config.yml.

The crafting recipe and ritual are still pending: the referenced recipe image wasn’t attached, and the project has no existing recipe to preserve. Please reattach the image so I can use the exact ingredients rather than guess.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 668
src/main/java/com/kodari/spidersword/SpiderSwordPlugin.java
package com.kodari.spidersword;

import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XMaterial;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.command.PluginCommand;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

public final class SpiderSwordPlugin extends JavaPlugin {
    private NamespacedKey swordIdentityKey;
    private SoulCaptureManager soulCaptureManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        swordIdentityKey = new NamespacedKey(this, "spider_sword_identity");
        soulCaptureManager = new SoulCaptureManager(this);

        Bukkit.getPluginManager().registerEvents(new SpiderSwordListener(this, soulCaptureManager), this);
        PluginCommand command = getCommand("spidersword");
        if (command != null) {
            command.setExecutor(new SpiderSwordCommand(this));
        }
    }

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

    public ItemStack createSpiderSword() {
        ItemStack sword = XMaterial.matchXMaterial("DIAMOND_SWORD")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Diamond sword is unavailable"));
        ItemMeta meta = sword.getItemMeta();
        if (meta == null) {
            throw new IllegalStateException("Could not create Spider Sword metadata");
        }

        meta.setDisplayName(color(getConfig().getString("sword.name", "&4&lSpider Sword")));
        List<String> lore = new ArrayList<>();
        for (String line : getConfig().getStringList("sword.lore")) {
            lore.add(color(line
                    .replace("{sharpness}", String.valueOf(getConfig().getInt("sword.sharpness-level", 7)))
                    .replace("{fire-aspect}", String.valueOf(getConfig().getInt("sword.fire-aspect-level", 7)))
                    .replace("{reach}", String.valueOf(getConfig().getDouble("sword.reach-blocks", 10.0)))
                    .replace("{duration}", String.valueOf(getConfig().getLong("soul-capture.duration-hours", 24)))));
        }
        meta.setLore(lore);
        meta.setUnbreakable(true);
        meta.getPersistentDataContainer().set(swordIdentityKey, PersistentDataType.STRING, "spider_sword:v1");

        int sharpnessLevel = getConfig().getInt("sword.sharpness-level", 7);
        XEnchantment.matchXEnchantment("SHARPNESS")
                .ifPresent(enchantment -> meta.addEnchant(enchantment.getEnchant(), sharpnessLevel, true));
        int fireAspectLevel = getConfig().getInt("sword.fire-aspect-level", 7);
        XEnchantment.matchXEnchantment("FIRE_ASPECT")
                .ifPresent(enchantment -> meta.addEnchant(enchantment.getEnchant(), fireAspectLevel, true));

        sword.setItemMeta(meta);
        return sword;
    }

    public boolean isSpiderSword(ItemStack item) {
        if (item == null || !item.hasItemMeta()) {
            return false;
        }
        return "spider_sword:v1".equals(item.getItemMeta().getPersistentDataContainer()
                .get(swordIdentityKey, PersistentDataType.STRING));
    }

    static String color(String message) {
        return ChatColor.translateAlternateColorCodes('&', message);
    }
}