elyspecter_op

> Create a fully functional Paper 1.21.11 Minecraft plugin called GodSword with the following exact specifications. Do not use any deprecated APIs. Use modern Paper/Adventure API for text components. The plugin should compile with Java 21. > > --- > > ITEM CREATION — /nullblade give <target> > > - <target> must support both exact player names and Minecraft selectors (@p, @a, @r, @s, @e[type=player,...]) > - The item is a renamed, unbreakable Netherite Sword with a persistent PersistentDataContainer tag (namespace: godsword, key: nullblade) so the plugin can reliably identify it separate from regular netherite swords > - Item name: Nullblade in color black (#000000) using Adventure API's TextColor > - Lore: Crafted from the darkest part of the world. in dark gray (#404040) using Adventure API > - The sword is fully enchantable by the player in vanilla — do not pre-apply any enchantments > - Unbreakable via ItemMeta.setUnbreakable(true) > - Cannot be destroyed except by being thrown into the void (void despawn is vanilla behavior, acceptable) > - CustomModelData: 9005 (for future resource pack / 3D model use) > - Base attack damage: 10 — set this via the GENERIC_ATTACK_DAMAGE attribute modifier on the item itself so it applies only when holding the Nullblade > > --- > > PERMANENT EFFECTS WHILE HOLDING IN MAIN HAND > > Apply all of the following potion effects via a repeating scheduler (every 5 ticks) that checks if the item in the player's main hand contains the godsword:nullblade PDC tag. Apply effects only while holding, remove them immediately when the player switches away, drops the item, or quits: > > - Speed II > - Strength I > - Fire Resistance (level 1) > - Resistance I > > Detect unhold via PlayerItemHeldEvent, PlayerDropItemEvent and PlayerQuitEvent — on any of these, remove all 4 effects if the player is no longer holding the Nullblade in main hand. > > --- > > THORNS IMMUNITY > > - When a Nullblade wielder attacks any player or entity, cancel any reflected thorns damage that would be dealt back to the attacker > - Implement via EntityDamageByEntityEvent — when the damager is a player holding the Nullblade (PDC check on main hand item) and the damage cause on a subsequent event would be THORNS, cancel it entirely > - The sword wielder should never take thorns reflected damage while holding the Nullblade under any circumstance > > --- > > COMMANDS > > Register under /nullblade: > - /nullblade give <target> — requires permission godsword.give > > Declare all commands and permissions in paper-plugin.yml > > --- > > GENERAL REQUIREMENTS > > - Clean up all potion effects and attribute modifiers on PlayerQuitEvent, PlayerItemHeldEvent, and PlayerDropItemEvent when the Nullblade is no longer in main hand > - Use NamespacedKey for all PDC operations > - No NMS unless strictly necessary — prefer Paper API throughout > - Handle null-safety everywhere: offline players, invalid arguments, empty hands > - Send clear colored feedback messages to the command sender on success and failure > - Include a comment in code noting that CustomModelData 9005 maps to the Nullblade for the resource pack / 3D model artist

Kodari AI
KodariApr 20 at 10:20 pm 10,578 (v2)
GodSword
A Paper 1.21.1 plugin adding the Nullblade — a legendary Netherite Sword identified via PersistentDataContainer tags. While held in main hand, it grants Speed II, Strength I, Fire Resistance, and Resistance I every 5 ticks. Nullblade wielders are immune to Thorns reflected damage. The item features black Adventure API text, CustomModelData 9005 for resource pack use, 10 base attack damage via attribute modifier, and is distributed via /nullblade give with full selector support.
  • Main plugin registers GUIManager (not needed here), scheduler task, listener, and command

  • NullbladeItem builds the item with PDC tag, Adventure API name/lore, attribute modifier, and CustomModelData 9005

  • NullbladeListener handles effect application every 5 ticks, effect removal on held/drop/quit events, and thorns immunity

  • Command supports both player names and Minecraft selectors via Bukkit.selectEntities

The plugin is complete. Here’s what was built:

  • NullbladeItem — creates the sword with black Adventure API name, dark gray lore, godsword:nullblade PDC tag, CustomModelData 9005, unbreakable flag, and a GENERIC_ATTACK_DAMAGE +9 ADD_NUMBER attribute modifier on the mainhand slot (1 base + 9 = 10 total)

  • NullbladeListener — runs a 5-tick repeating task applying Speed II, Strength I, Fire Resistance I, and Resistance I (all ambient, no particles); removes effects on PlayerItemHeldEvent, PlayerDropItemEvent, and PlayerQuitEvent; cancels THORNS damage when the victim is a Nullblade holder

  • NullbladeCommand — handles /nullblade give <target> with both exact name and @p/@a/@r/@s/selector support via Bukkit.selectEntities, with permission checks and colored feedback

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
6 372
src/main/java/com/godsword/GodSword.java
package com.godsword;

import com.godsword.command.NullbladeCommand;
import com.godsword.listener.NullbladeListener;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

public class GodSword extends JavaPlugin {

    @Getter
    private static GodSword instance;

    @Getter
    private NullbladeListener nullbladeListener;

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

        nullbladeListener = new NullbladeListener(this);
        getServer().getPluginManager().registerEvents(nullbladeListener, this);

        NullbladeCommand command = new NullbladeCommand(this);
        getCommand("nullblade").setExecutor(command);
        getCommand("nullblade").setTabCompleter(command);
    }

    @Override
    public void onDisable() {
        if (nullbladeListener != null) {
            nullbladeListener.cancelTask();
        }
    }
}