not_cvr

PaperMC 1.21.11 plugin for a custom Stone Sword named 'God Stone Sword'. It must work on all players and mobs. Features: ​Deals 5 hearts true damage bypassing armor on hit. ​Off-hand ability: When held in the off-hand, holding right-click or shifting continuously shoots multiple arrows/projectiles. ​Thunder ability: Holding the right mouse button continuously strikes lightning at the targeted location/aimed direction. ​Command setup: Include a command (e.g., /godsword damage <amount>) to dynamically configure arrow or custom damage.

Keep the code clean, optimized, and error-free."

Kodari AI
KodariOct 26 at 4:11 pm 1
GodStoneSword
Creates a custom Stone Sword named 'God Stone Sword' for PaperMC 1.21.11. The sword deals 5 hearts (10 damage) of true damage bypassing armor to all players and mobs. When held in the off-hand, continuously holding right-click or shift fires multiple arrows/projectiles. Holding right-click with the sword triggers lightning strikes at the targeted location. Includes a /godsword damage &lt;amount&gt; command to dynamically configure the damage value. Clean, optimized, and error-free code.

Plan:

  1. Create the Paper 1.21.11 project scaffold and config.

  2. Add the tagged sword, armor-bypassing melee/projectile damage, and repeating off-hand abilities.

  3. Add /godsword give and /godsword damage <amount>.

Created the Paper 1.21.11 God Stone Sword project.

  • Melee hits, arrows, and lightning deal configurable true damage that bypasses armor; default is 10 health points (5 hearts).

  • Hold the sword in your off-hand and sneak to continuously fire arrows. Right-click toggles repeating arrows; sneak-right-click toggles repeating lightning. Remove the sword from your off-hand to stop a repeating mode.

  • /godsword give [player] gives the sword; /godsword damage <amount> updates damage and saves it to config.

Bukkit doesn’t expose a reliable right-click-release event for this item, so right-click uses a toggle rather than firing only while the button is held.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 338
src/main/java/com/kodari/godsword/GodSwordPlugin.java
package com.kodari.godsword;

import com.cryptomorin.xseries.XMaterial;
import java.util.Objects;
import org.bukkit.NamespacedKey;
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 GodSwordPlugin extends JavaPlugin {
    private NamespacedKey swordKey;
    private NamespacedKey projectileKey;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        swordKey = new NamespacedKey(this, "god_stone_sword");
        projectileKey = new NamespacedKey(this, "god_sword_projectile");

        getServer().getPluginManager().registerEvents(new GodSwordListener(this), this);
        Objects.requireNonNull(getCommand("godsword")).setExecutor(new GodSwordCommand(this));
    }

    public ItemStack createGodSword() {
        ItemStack sword = XMaterial.matchXMaterial("STONE_SWORD")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("STONE_SWORD is unavailable"));
        ItemMeta meta = sword.getItemMeta();
        meta.setDisplayName("§6God Stone Sword");
        meta.setUnbreakable(true);
        meta.getPersistentDataContainer().set(swordKey, PersistentDataType.BYTE, (byte) 1);
        sword.setItemMeta(meta);
        return sword;
    }

    public boolean isGodSword(ItemStack item) {
        return item != null
                && item.hasItemMeta()
                && item.getItemMeta().getPersistentDataContainer().has(swordKey, PersistentDataType.BYTE);
    }

    public boolean isGodSwordProjectile(org.bukkit.entity.Arrow arrow) {
        return arrow.getPersistentDataContainer().has(projectileKey, PersistentDataType.BYTE);
    }

    public void markGodSwordProjectile(org.bukkit.entity.Arrow arrow) {
        arrow.getPersistentDataContainer().set(projectileKey, PersistentDataType.BYTE, (byte) 1);
    }

    public NamespacedKey getProjectileKey() {
        return projectileKey;
    }

    public double getDamage() {
        return getConfig().getDouble("damage", 10.0);
    }

    public void setDamage(double damage) {
        getConfig().set("damage", damage);
        saveConfig();
    }
}