📄
pasted-code-1789770054493.txt
txt
57 lines
▶
Create a custom Minecraft weapon called **Lassow**.
### Item
* The item is a **Lead**.
* Its display name must be **Lassow**.
* Only **OP players** can obtain/use the Lassow.
* Make sure normal Leads are completely unaffected.
* The Lassow should be uniquely identified so renaming a normal Lead does not activate the weapon.
### Abilities
**Right-click — Throw**
* Throw the Lassow like a cowboy lasso.
* Maximum range: 20 blocks.
* If it hits a player, capture them.
* Create a visible rope connection between the user and the target.
* The target cannot simply walk away while captured.
**Right-click again — Pull**
* Pull the captured player toward the Lassow user.
* Do not teleport them; physically pull them toward the player.
**Crouch + Right-click — Long Throw**
* Swing the Lassow around the player's head briefly.
* Throw it up to 30 blocks.
* If it hits a player, capture them.
**Left-click — Whip**
* Use the Lassow as a short-range whip.
* Deal a small amount of damage and knock the target backward.
* Play a whip sound and particle effect.
### Escape
* The captured player can escape by repeatedly crouching/jumping.
* After enough successful inputs, the Lassow breaks.
* The rope also breaks if the target gets more than 25 blocks away.
### Visuals
* Make the Lassow visibly fly through the air.
* Add rope/particle effects while it is flying.
* Show a visible rope between the user and captured player.
* Add cowboy-style sounds for throwing, hitting, pulling, and breaking.
### Important
* Must work on **Minecraft Java 1.21.11**.
* Only OPs can obtain or use the custom Lassow.
* Normal Leads must work exactly as they normally do.
* Add configurable cooldowns, range, damage, pull strength, and escape requirements.
Create the Paper/Gradle project and plugin metadata for Java 21 / Minecraft 1.21.11.
Implement a uniquely tagged Lassow item, OP-only command and interaction handling.
Add animated throws, rope particles, capture/pull behavior, whip combat, escape handling, cooldowns, and configurable settings.
Implemented the Lassow plugin from scratch with:
Java 21 / Paper 1.21.11 project setup
OP-only
/lassow givecommandUnique PersistentDataContainer identification
Normal Leads remain unaffected
Standard and crouching long throws
Visible flying Lead and rope particle effects
Player capture and physical pulling
Tether distance limit
Crouch/jump escape system that breaks the Lassow
Short-range whip damage and knockback
Configurable cooldowns, ranges, damage, pull strength, sounds, and escape requirements
Cleanup on player death, quit, and plugin shutdown
how does it work?
The Lassow works as a custom, OP-only weapon built on top of the normal Minecraft Lead item.
How it is identified
The plugin marks the special Lead with a hidden custom data value. This means:
A normal Lead is not treated as a Lassow.
Renaming a normal Lead to “Lassow” does not activate it.
Only Leads created by the plugin are recognized.
Non-OP players cannot obtain or use the weapon.
Throwing
When the owner right-clicks with the Lassow:
The plugin checks whether the item is the custom Lassow.
It checks the cooldown.
It launches a visible Lead-like projectile in the direction the player is looking.
Particles are created along its path.
The projectile searches for a player within the configured range.
If it reaches or detects a player, that player becomes captured.
A normal throw uses the shorter configured range. Crouching while right-clicking uses the long-throw range and briefly creates a swinging effect before launching.
Capturing and rope behavior
After a player is captured, the plugin stores the relationship between:
The Lassow owner
The captured target
It then repeatedly draws particles between them to represent the rope.
The target is not simply teleported back. Instead, the plugin checks the distance and applies movement toward the owner when pulling or when the tether needs to prevent the target from walking away.
Pulling
Right-clicking again while the owner has someone captured changes the action from throwing to pulling.
The plugin applies directional velocity to the captured player. This physically moves the target toward the Lassow owner rather than instantly teleporting them.
Whip attack
Left-clicking with the Lassow performs a short-range attack:
Nearby players are searched for in front of the owner.
The first valid target is damaged.
Knockback is applied away from the owner.
A whip-style sound and particle effect are played.
A separate cooldown prevents rapid repeated use.
Escaping
The captured player can escape by performing the configured escape inputs, such as:
Crouching
Jumping
Each valid input increases their escape progress. Once the required number of inputs is reached:
The capture is removed.
The rope effect stops.
A breaking sound/effect is played.
The Lassow is considered broken or released.
The rope also automatically breaks if the target exceeds the configured maximum tether distance, such as 25 blocks.
Cleanup
The plugin releases captures when necessary, including situations such as:
The owner disconnecting
The target disconnecting
Either player dying
The plugin shutting down
The rope distance becoming invalid
The escape requirement being completed
All behavior is controlled through the configuration, including ranges, cooldowns, damage, pull strength, escape count, and sound settings.
when i right click it doesnt throw the lassow and when i pull them its supposed to fling them quick to me and they cant move while lassowed acceot being pulled
Fix right-click handling so the Lassow throw is processed reliably.
Make captured targets immobile except during an active pull.
Make pulling a short sustained fling toward the owner with stronger configurable force.
Fixed:
Right-click handling now runs even if another plugin cancelled the interaction event.
Captured players are locked in place and cannot walk away.
Jumping still counts toward escape progress.
Pulling now lasts for several ticks instead of applying one weak velocity impulse.
Pull strength increased from
1.0to1.6, producing a faster fling toward the Lassow owner.Added configurable pull duration:
pull:
strength: 1.6
duration-ticks: 8
Use /lassow give to obtain a newly tagged Lassow, then restart or reload the plugin before testing. Right-click throws it; after capturing someone, right-click again pulls them quickly toward you.
package com.kodari.lassow;
import java.util.Objects;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;
public final class LassowPlugin extends JavaPlugin {
private NamespacedKey lassowKey;
private LassowManager lassowManager;
@Override
public void onEnable() {
saveDefaultConfig();
lassowKey = new NamespacedKey(this, "lassow_weapon");
lassowManager = new LassowManager(this);
getServer().getPluginManager().registerEvents(new LassowListener(lassowManager), this);
Objects.requireNonNull(getCommand("lassow")).setExecutor(new LassowCommand(lassowManager));
lassowManager.start();
}
@Override
public void onDisable() {
if (lassowManager != null) {
lassowManager.shutdown();
}
}
public NamespacedKey getLassowKey() {
return lassowKey;
}
}