yama_tkd

Create a Minecraft Spigot/Paper plugin (Java) that adds a custom Netherite Sword called "Pull Sword".

Requirements:

The sword must have a custom name: Pull Sword When a player SHIFT + RIGHT-CLICKS (sneak + right click) while holding the sword, it should:

Detect the entity the player is directly looking at (max range ~10 blocks) If the target is a player:

Pull the target toward the user Deal exactly 2.5 hearts (5 HP) of damage Apply a “chain” effect: the target is chained toward the player that used the sword for 5 seconds after that it stops The ability should ONLY activate if the player is sneaking The ability must have a 40-second cooldown show it in the chat or the actiom bar whenever its in hand Use clean, optimized, and modern Spigot/Paper API practices Use PersistentDataContainer to identify the custom sword Include proper null checks and prevent misuse

Output:

Full main class plugin.yml file Well-commented code explaining each part

Kodari AI
KodariMar 22 at 5:28 pm 13,028 (v2)

I’ll create a pull sword plugin with custom abilities, cooldown management, and chain effects.

PullSwordPlugin
A custom Netherite Sword that pulls players toward the wielder when shift-right-clicking. Features include raycast target detection, damage dealing, chain pulling effects with particles, 40-second cooldown management, action bar cooldown display, and PersistentDataContainer sword identification. Uses modern Spigot API with proper event handling and scheduler-based chain effects.
PullSwordPlugin
A custom Netherite Sword that pulls players toward the wielder when shift-right-clicking. Features include raycast target detection, damage dealing, chain pulling effects with particles, 40-second cooldown management, action bar cooldown display, and PersistentDataContainer sword identification.

Summary

Created a complete Pull Sword plugin with:

Core Features:

  • ✅ Custom Netherite Sword with PersistentDataContainer identification

  • ✅ Shift + Right-click activation (only when sneaking)

  • ✅ Raycast target detection (10 block range)

  • ✅ Pulls target player with initial velocity boost

  • ✅ Deals exactly 2.5 hearts (5 HP) damage

  • ✅ 5-second chain effect with continuous pulling and particle trail

  • ✅ 40-second cooldown system

  • ✅ Real-time cooldown display in action bar when holding sword

  • ✅ /pullsword command to obtain the sword

Technical Highlights:

  • XSeries for cross-version compatibility (materials, sounds, particles)

  • PersistentDataContainer for reliable item identification

  • BukkitRunnable for smooth chain effect (100 ticks = 5 seconds)

  • World.rayTraceEntities() for accurate target detection

  • Vector math for pull mechanics

  • Action bar updates every second showing cooldown status

  • Proper cleanup of active effects and display tasks

  • Null safety and validation checks throughout

The sword creates a visual chain effect with crit particles, plays thematic sounds, and provides clear feedback to both attacker and target.

yama_tkd

Make it work in every dimension except pvp dimension

Kodari AI
KodariMar 22 at 5:33 pm 7,056 (v2)

I’ll read the existing files to understand the current implementation, then add a check to prevent the pull sword from working in the PVP dimension.

I’ll add world restrictions to prevent the pull sword from working in the PVP dimension.

The plugin now blocks Pull Sword usage in disabled worlds. The config.yml includes “pvp” and “world_pvp” by default, and you can add or remove worlds as needed.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 479
src/main/java/com/pullsword/PullSwordPlugin.java
package com.pullsword;

import com.pullsword.command.PullSwordCommand;
import com.pullsword.listener.CooldownDisplayListener;
import com.pullsword.listener.PullSwordListener;
import com.pullsword.manager.CooldownManager;
import com.pullsword.manager.PullSwordManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class PullSwordPlugin extends JavaPlugin {
    private PullSwordManager pullSwordManager;
    private CooldownManager cooldownManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.cooldownManager = new CooldownManager();
        this.pullSwordManager = new PullSwordManager(this);

        Bukkit.getPluginManager().registerEvents(new PullSwordListener(this), this);
        Bukkit.getPluginManager().registerEvents(new CooldownDisplayListener(this), this);

        getCommand("pullsword").setExecutor(new PullSwordCommand(this));

        getLogger().info("PullSword plugin has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("PullSword plugin has been disabled!");
    }
}