📄
pasted-code-1792082861866.txt
txt
235 lines
▶
# Minecraft Custom Weapons & Red Netherite God Armor — Complete Bug Fix and Working Plugin Prompt
I already have a Minecraft custom weapons plugin, but many abilities are not working correctly. Shift + Right Click does not activate the abilities, the crossbow cannot properly kill players holding Totems of Undying, and several custom swords do not work.
**Your task is to fix the existing plugin completely or rebuild the broken systems if necessary. Do not just rename items, change lore, or create visual effects. Every ability must execute its actual gameplay functionality.**
Develop a complete, working Minecraft Java Edition plugin using a compatible Paper API version.
## 1. Critical Fix: Shift + Right Click Must Work
This is the highest priority.
Every custom weapon ability that uses Shift + Right Click must work reliably when a player holds the correct weapon, crouches, and right-clicks a valid target.
Requirements:
- Detect the correct player interaction events.
- Support Shift + Right Click with both air and block interactions where appropriate.
- Correctly identify the custom item using PersistentDataContainer or another reliable unique identifier.
- Check that the player is sneaking, holding the correct weapon, and targeting a valid entity.
- Make sure other plugins or vanilla event cancellation do not silently prevent the ability from activating.
- Handle main-hand and off-hand events correctly to prevent duplicate activations.
- Ensure the ability can be activated while the player is aiming at another player, without requiring an accidental extra click.
- If direct player targeting is unreliable, implement a server-side ray-tracing target system with a configurable range.
- Check cooldowns, permissions, target validity, and world restrictions before executing an ability.
- Display an activation message, particles, or sound only after the ability has successfully started.
- Log useful errors when an ability fails instead of silently doing nothing.
**Important:** Do not claim an ability is fixed until it has been tested in actual multiplayer gameplay.
## 2. Red Netherite God Armor
Create a complete four-piece armor set based on Netherite armor.
**Appearance:**
- Base armor material: Netherite Helmet, Netherite Chestplate, Netherite Leggings, and Netherite Boots.
- Custom appearance: Red Netherite armor with a deep red primary color, black details, and a powerful God Armor design.
- Use a compatible resource pack with custom armor textures and the necessary model or equipment definitions for the selected Minecraft version.
- If custom textures cannot be delivered inside the plugin itself, provide the resource pack separately and explain how to install it.
- Do not substitute ordinary leather armor for the requested Netherite armor.
**Enchantments:**
- Protection IV on all four armor pieces.
- Mending on all four armor pieces.
- Unbreaking III on all four armor pieces.
- Add any other requested custom effects through a supported implementation.
**God Armor abilities:**
1. Equipping the complete set increases the wearer's maximum health to 40 health points (20 hearts).
2. Give the wearer an effective attack reach of up to 6 blocks, subject to server-side targeting and interaction validation.
3. Activate the armor bonus only while the complete set is equipped.
4. Remove the bonus safely when any required armor piece is removed.
5. Prevent duplicate health modifiers, permanent health bonuses, and repeated attribute stacking.
6. Add red particles, black smoke, and a distinctive activation effect.
7. Ensure the armor and its abilities survive normal inventory movement, player death, and server restarts correctly.
Use actual Netherite equipment as the underlying material. Apply the custom red texture using a compatible resource pack instead of replacing the armor with leather.
## 3. God Mace — Fix the Sonic Boom Ability
**Enchantments:**
- Density V
- Wind Burst III, if supported by the selected Minecraft version or implemented compatibly
- Mending
- Unbreaking III
**Activation:** Shift + Right Click while targeting an enemy.
**Required functionality:**
- Correctly detect the activation.
- Launch a Warden-style sonic boom toward the intended target.
- Make the projectile or ray hit the selected enemy reliably.
- On a successful hit, eliminate the target in one hit, subject to the configured PvP protection rules.
- Apply the effect only to the intended target.
- Play the correct sound and particles.
- Add a configurable cooldown.
- Prevent duplicate attacks from main-hand and off-hand event handling.
Do not create only a sonic-boom particle effect. The ability must actually deal the intended damage.
## 4. Control Sword — Fix Player Control
**Enchantments:**
- Sharpness VI
- Mending
- Unbreaking III
**Activation:** Shift + Right Click while targeting an enemy player.
**Required functionality:**
- Start a real control session lasting exactly 60 seconds.
- Allow the owner to control the target's movement through supported server-side actions.
- Support launching the target, pulling or pushing them, and forcing them toward the ground.
- If using a control menu, make every button execute its corresponding action.
- Show the remaining duration using a boss bar or action bar.
- End the control session automatically after 60 seconds.
- Apply a 120-second cooldown after the session ends.
- Release the target correctly if either player disconnects, dies, changes worlds, or the plugin shuts down.
- Never leave the target permanently frozen or affected by movement effects.
The Shift + Right Click event must open or activate the control system every time the conditions are valid.
## 5. Totem Breaker Crossbow — Fix Totem Bypass
This ability is currently broken and must be completely repaired.
**Activation:** Shoot an enemy player with the custom Totem Breaker Crossbow.
**Required functionality:**
- Use a real crossbow shooting event and correctly identify projectiles fired by the custom crossbow.
- Track the projectile's shooter and custom weapon identity.
- Correctly handle direct hits, projectile damage, event ordering, and lethal damage.
- If the target holds a Totem of Undying in either hand, the attack must still eliminate the target in one successful hit.
- If the target holds two Totems, neither Totem should save them from this custom attack.
- Do not rely on ordinary lethal damage alone: Minecraft's Totem activation can cancel a normal death.
- Implement a dedicated, tested server-side execution mechanism that handles Totem activation and death events correctly.
- Ensure the target actually dies instead of merely losing health or triggering a Totem animation.
- When the target dies because of the Totem Breaker, summon a lightning visual at the exact death location.
- Prevent unintended fire, collateral damage, duplicate death handling, and lightning damage to nearby players.
- Apply a configurable cooldown and provide clear feedback when the ability activates or cannot be used.
**Critical test cases:**
1. Target has no Totem.
2. Target holds a Totem in the main hand.
3. Target holds a Totem in the off-hand.
4. Target holds Totems in both hands.
5. Target has high health, Protection armor, and other damage-reduction effects.
6. Two projectiles hit the same target in quick succession.
All six cases must be tested on a real test server. Do not mark the feature complete if a Totem prevents the intended elimination.
## 6. Immunity Blade — Fix the Immunity Ability
**Enchantments:**
- Sharpness VIII
- Mending
- Unbreaking III
**Activation:** Shift + Right Click while targeting a valid player.
**Required functionality:**
- Activate the real immunity system.
- Apply temporary protection against incoming damage for the configured duration.
- Prevent the ability from accidentally granting permanent invulnerability.
- Show the effect using particles and an activation sound.
- Handle death, disconnects, world changes, and plugin reloads safely.
- Apply a configurable cooldown.
- Ensure the immunity system does not interfere with the Totem Breaker or other custom weapons.
## 7. Warden Army Sword — Fix the Bodyguard AI
**Enchantments:**
- Sharpness XI
- Mending
- Unbreaking III
**Activation:** Shift + Right Click while targeting an enemy player.
**Required functionality:**
- Summon exactly two Wardens.
- Register both Wardens as allies of the summoning player.
- Make both Wardens attack the selected enemy rather than their owner.
- Use a proper ownership and target-management system.
- Ensure the owner is never selected as an intentional attack target.
- Use compatible server-side entity targeting and Warden behavior.
- Do not depend on ordinary vanilla Warden anger mechanics alone if they cannot reliably enforce the intended target.
- Both Wardens must remain active for exactly 180 seconds.
- Remove both Wardens automatically after 180 seconds.
- Apply a 300-second cooldown to the summoning ability.
- Prevent additional summons while the owner's summon limit is reached.
- Remove summoned Wardens safely when necessary and clean up their tracking data.
- Display a success message and suitable summoning effects.
## 8. Fix the Entire Custom Ability System
Create a central ability manager instead of implementing disconnected, unreliable click handlers for every weapon.
The manager must:
- Identify each custom weapon using a unique persistent item identifier.
- Dispatch the correct ability for the item held.
- Detect Shift + Right Click reliably.
- Support entity targeting with ray tracing.
- Handle cooldowns, target validation, and permissions.
- Avoid duplicate main-hand and off-hand activation.
- Track active control sessions, immunity effects, and summoned Wardens.
- Restore modified player attributes and effects when abilities end.
- Save any required persistent state safely.
- Avoid blocking the server's main thread.
- Log errors with enough information to identify the broken ability.
## 9. Commands That Must Actually Work
Implement and register the following command system:
- `/custom ability` — Open the ability menu or display available abilities and instructions.
- `/custom ability status` — Display active abilities and cooldowns.
- `/custom ability help` — Display command usage.
- `/custom ability reload` — Reload the configuration safely.
- `/custom ability resetcooldown ` — Reset custom ability cooldowns for a player.
Item-giving commands:
- `/custom give godmace`
- `/custom give controlsword`
- `/custom give totembreaker`
- `/custom give immunityblade`
- `/custom give wardenarmysword`
- `/custom give redgodarmor`
Register every command and permission correctly in `plugin.yml`. Provide tab completion, helpful error messages, and proper permission checks.
Permissions:
- `customweapons.use`
- `customweapons.give`
- `customweapons.admin`
The command `/custom ability` must execute a real action. It must not return an unknown command or display a menu that does nothing.
## 10. Required Debugging and Testing
Before delivering the plugin:
1. Inspect the existing source code and identify why Shift + Right Click fails.
2. Inspect crossbow projectile tracking and Totem handling.
3. Inspect all sword interaction listeners and fix the underlying problems.
4. Check for event cancellation, incorrect event priorities, main-hand/off-hand duplication, cooldown bugs, and invalid target detection.
5. Rebuild the plugin and verify that it compiles successfully.
6. Test all five weapons and the complete Red Netherite God Armor on the exact target Minecraft version.
7. Test on a multiplayer Paper server, not just in a single-player environment.
8. Verify that all commands, cooldowns, timers, particles, damage, and entity cleanup work correctly.
9. Provide a test report showing which features were tested and the results.
10. Deliver the complete source code, compiled JAR, configuration file, resource pack, and installation instructions.
**Final requirement:** Every advertised ability must perform its intended gameplay action. Do not use fake success messages, particles without functionality, placeholder methods, or empty event handlers. If an API limitation exists, implement a reliable alternative and explain it. Never claim that a feature works unless it has actually been tested.
Preserve all requested weapon names, enchantment levels, ability durations, cooldowns, and Red Netherite armor requirements. Prioritize fixing the actual bugs before adding new visual effects.
Create the Paper plugin scaffold and configuration for the requested weapons, armor, cooldowns, and permissions.
Implement persistent item IDs, the central ability/event manager, armor-set bonuses, and cleanup for timed effects.
Register
/customcommands, then note which visual and multiplayer-test requirements cannot be verified here.
Created the Paper 1.21.4 plugin scaffold with custom item IDs, weapon abilities, armor-set tracking, configuration, permissions, and /custom commands.
Implemented shift-right-click handling for air, blocks, and entity clicks; custom crossbow shots track their projectile and remove Totems from both hands before execution.
Added the 60-second Control Sword session and action commands, temporary Immunity Blade protection, Warden summons, and God Mace damage.
Added Netherite God Armor with the requested enchantments, temporary health and reach bonuses, and saved attribute restoration.
Not verified: I haven’t run this on a multiplayer Paper server or tested the requested Totem cases, so I can’t provide a passing test report or claim the abilities are verified.
Appearance: The armor uses actual Netherite, but its red/black texture resource pack is not included. Texture generation is disabled for this project; enable it in Settings → Generation to create the custom appearance.
To get the JAR, click Compile in the desktop top bar—or ⋮ → Compile Project on phone—then click Compile and Download when it succeeds.
package dev.kodari.customweapons;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public final class CustomWeaponsPlugin extends JavaPlugin {
private AbilityManager abilityManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.abilityManager = new AbilityManager(this);
Bukkit.getPluginManager().registerEvents(this.abilityManager, this);
PluginCommand command = getCommand("custom");
if (command == null) {
getLogger().severe("The custom command is missing from plugin.yml.");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
CustomCommand handler = new CustomCommand(this, this.abilityManager);
command.setExecutor(handler);
command.setTabCompleter(handler);
}
@Override
public void onDisable() {
if (this.abilityManager != null) {
this.abilityManager.shutdown();
}
}
public AbilityManager getAbilityManager() {
return this.abilityManager;
}
}