📄
pasted-code-1789913206616.txt
txt
52 lines
▶
Act as an expert Minecraft plugin developer. I need you to write a complete, production-ready Paper/Spigot plugin for Minecraft version 1.20.x+ / 1.21.x+ (using the modern Component API / MiniMessage).
The plugin is inspired by "Flow SMP". It gives players powerful active abilities when they wear a FULL 4/4 SET of armor with a matching Armor Trim pattern (such as RIB) and the same Trim Material.
Here are the strict functional requirements:
### 1. CORE MECHANICS
- Full Set Requirement: A player MUST wear a Helmet, Chestplate, Leggings, and Boots. All four pieces must have the EXACT same Armor Trim Pattern and the EXACT same Trim Material.
- Trigger Mechanism: Active abilities are triggered when a player presses SHIFT + SWAP HAND KEY (Default: F) while wearing a complete set.
- Cooldowns: Every active ability must have a configurable cooldown (default: 30 seconds). Display an action bar or chat message if they try to use it on cooldown: "Ability on cooldown! ({seconds}s remaining)"
### 2. THE 10 VALID TRIM MATERIALS & ACTIVE ABILITIES
Please implement a distinct active ability for these official trim materials:
1. REDSTONE ("The Bloodlust Berserker")
- Ability: On Shift+F, enter a Redstone Rage for 7 seconds. Instantly gain Strength II and Speed I. While active, your melee attacks inflict 50% more knockback and spawn an explosion of red dust particles on the victim. If you get a kill while this is active, the cooldown of this ability is instantly reset.
2. DIAMOND ("The Juggernaut")
- Ability: On Shift+F, grant Resistance II and Fire Resistance I for 10 seconds. Knock back all enemies within a 5-block radius by 2 blocks with a burst of crit particles.
3. NETHERITE ("The Overlord")
- Ability: On Shift+F, shoot a beam of wither particles forward. The first enemy hit within 10 blocks is inflicted with Wither II and Slowness II for 6 seconds.
4. GOLD ("The Chrono Speedster")
- Ability: On Shift+F, grant Speed III and Haste II for 8 seconds. For the first 3 seconds, any incoming projectiles (arrows/tridents) are deflected away from the player.
5. LAPIS LAZULI ("The Arch-Mage")
- Ability: On Shift+F, summon a lightning strike at the block the player is looking at (up to 15 blocks away). Deals 4 generic damage (2 hearts) to anyone within 3 blocks and gives the user 3 Absorption hearts.
6. IRON ("The Bastion")
- Ability: On Shift+F, slam the ground. Grant the user Slowness I but complete Knockback Immunity and +5 Generic Armor for 8 seconds. Creates an iron-pop particle explosion.
7. RESIN BRICK ("The Amber Trap")
- Ability: On Shift+F, create an orange particle shockwave. For the next 5 seconds, any player who attacks the user is inflicted with Slowness IV and cannot jump for 3 seconds (simulating getting stuck in sap).
8. EMERALD ("The Merchant's Fortune")
- Ability: On Shift+F, unleash a shockwave of emerald particles. All entities within a 6-block radius are affected by "Glow" for 10 seconds, and the user gains Luck III and a temporary 10% damage buff for 5 seconds.
9. QUARTZ ("The Phantom Marksman")
- Ability: On Shift+F, launch the player 8 blocks backward in the direction they are facing (an escape mechanic) while granting Levitation I to the closest enemy within 4 blocks for 3 seconds.
10. AMETHYST ("The Sonic Echo")
- Ability: On Shift+F, emit a loud amethyst chime sound and an expanding ring of purple particles. All nearby players within an 8-block radius have their current cooldowns increased by 5 seconds, and are disoriented (Nausea I for 5 seconds).
### 3. TECHNICAL IMPLEMENTATION DETAILS
- Listeners: Implement a PlayerArmorChangeEvent (Paper API) or an inventory click/interact listener to detect when a player equips or unequips a full matching set. Store them in an internal map.
- NBT/Trim Check: Safely fetch ArmorMeta, check if it has a Trim, and compare `trim.getPattern()` and `trim.getMaterial()`.
- Input Interception: Listen for PlayerSwapHandItemsEvent. If the player is sneaking (isSneaking()) and has a valid full set, cancel the event and fire the respective active ability.
- Clean Code: Structure the project efficiently (Main class, AbilityManager, Listener classes). Use a clean cooldown system (like storing System.currentTimeMillis() against player UUIDs) to prevent memory leaks. Include an EntityDeathEvent listener to check for the Redstone kill-reset mechanic.
Provide the complete Java code structure and logic to handle all 10 materials.
Create the Gradle Paper plugin project and metadata.
Add trim detection, cooldown tracking, and all ten active abilities.
Add event listeners for activation, combat effects, projectile deflection, armor refresh, and kill reset.
Add configurable cooldowns and user-facing MiniMessage feedback.
Implemented the complete FlowSMP abilities plugin with:
Gradle Paper 1.21.4 project setup
MiniMessage feedback and action bars
Exact 4/4 matching armor trim validation
Configurable per-material cooldowns
Shift + swap-hand activation
All 10 trim-based abilities
Redstone rage combat effects and kill cooldown reset
Projectile deflection, knockback immunity, trap effects, cooldown extension, and armor refresh handling
Inventory, interaction, join, quit, combat, movement, velocity, death, and projectile listeners
Created the project under com.kodari.flowsmp.
make it only work on rib trims
Updated the plugin so abilities only activate when all four armor pieces:
Have a trim
Use the exact same trim material
Use the
RIBtrim pattern
Any other trim pattern is now rejected.
package com.kodari.flowsmp;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class FlowSMPPlugin extends JavaPlugin {
private AbilityManager abilityManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.abilityManager = new AbilityManager(this);
Bukkit.getPluginManager().registerEvents(new FlowListener(this, abilityManager), this);
Bukkit.getScheduler().runTaskTimer(this, abilityManager::refreshOnlinePlayers, 0L, 10L);
}
@Override
public void onDisable() {
if (abilityManager != null) {
abilityManager.clear();
}
}
}