Mobley MobleyMC
📎 1 file 8,992 chars
📄
message.txt
txt 248 lines
▶
Create my Minecraft plugin. Type: Custom Items / Weapons. Minecraft version: 1.21.11. Server software: Paper. Plugin idea: # MINECRAFT CUSTOM PLUGIN DEVELOPMENT — GODSTORM MACE

Act as an expert Minecraft Java Plugin Developer, specializing in Paper/Spigot plugins, Java programming, custom weapons, particle effects, and Minecraft resource packs.

I want you to develop a complete, fully functional Minecraft custom weapon plugin called **Godstorm Mace**.

The weapon should have powerful custom abilities, special effects, custom enchantments, and its own blue-themed texture.

## 1. CUSTOM WEAPON INFORMATION

- Weapon Name: §b§lGODSTORM MACE
- Weapon Type: Minecraft Mace
- Rarity: Legendary
- Theme: Blue Lightning / Storm / Divine Power
- Weapon should have a unique appearance using a custom resource pack.
- Only the custom Godstorm Mace should have these special abilities. Normal Minecraft maces must remain unaffected.

Use PersistentDataContainer or another reliable identification system to identify the custom mace. Do not identify it using its display name alone.

## 2. SPECIAL ABILITIES

### Ability 1: Permanent Speed II
- Whenever a player holds the Godstorm Mace in either hand, give them Speed II.
- Remove the custom Speed effect when they stop holding the mace.
- Do not interfere unnecessarily with other potion effects.

### Ability 2: Permanent Regeneration I
- Whenever a player holds the Godstorm Mace in either hand, give them Regeneration I.
- Remove the custom Regeneration effect when they stop holding the mace.
- Make sure the effect refreshes smoothly without flickering.

### Ability 3: SKY LAUNCH + MASSIVE EXPLOSION

This is the mace's main special ability.

Activation:
- Player must crouch (SHIFT).
- Player must right-click while holding the Godstorm Mace.
- Launch the player approximately 10 Minecraft blocks into the sky.
- Emit special blue particles around the player during the launch.
- Play a powerful custom activation sound.
- Give the player a short cooldown to prevent ability spam.

Impact:
- When the launched player hits another player, activate a massive explosion around the target.
- Explosion radius: Approximately 5 blocks.
- Explosion should deal extremely high damage, similar to TNT Minecart damage.
- The explosion should create powerful knockback.
- Add blue lightning particles, explosion particles, and appropriate sounds.
- The explosion must not destroy blocks.
- Do not damage the player who activated the ability.
- Make sure the ability works correctly in multiplayer.

Important: Track the launched player's state and detect valid player impacts reliably. Do not trigger the explosion just because the player touches the ground.

### Ability 4: SPECIAL LAUNCH PARTICLES

Whenever the Sky Launch ability activates:

- Emit blue flame particles.
- Emit electric spark particles.
- Emit soul-like blue particles.
- Create a swirling particle effect around the player.
- Add particles underneath the player's feet.
- Make the effect look powerful and legendary.

Particles should follow the player during the launch rather than staying at the original location.

### Ability 5: THUNDER STRIKE

Whenever the player performs a normal melee attack with the Godstorm Mace:

- Summon a Minecraft lightning strike at the location of the player who gets hit.
- Lightning should visually strike the target.
- The target should receive the normal mace attack damage as well.
- The lightning must not accidentally damage the attacker.
- Prevent unnecessary repeated lightning strikes from one attack.
- The lightning must work against players and mobs.

Use visual-only lightning where necessary to avoid additional unintended damage.

## 3. CUSTOM ENCHANTMENTS

The Godstorm Mace must have the following enchantments:

| Enchantment | Level |
|---|---:|
| Density | VII (7) |
| Breach | VII (7) |
| Wind Burst | IV (4) |
| Mending | I |
| Unbreaking | VII (7) |

Requirements:
- Support enchantment levels beyond normal survival limits.
- Make sure all enchantments actually work.
- Do not simply display enchantment names without implementing their effects.
- Prevent enchantment conflicts from breaking the weapon.

## 4. CUSTOM CRAFTING RECIPE

The Godstorm Mace must be obtainable through a custom 3x3 crafting table recipe.

Required crafting ingredients:

- 1 Heavy Core
- 1 Breeze Rod
- 4 Wind Charges
- 1 Netherite Sword
- 1 Netherite Axe

Exact crafting table arrangement:

| Top Left | Top Middle | Top Right |
|---|---|---|
| Wind Charge | Heavy Core | Wind Charge |

| Middle Left | Middle | Middle Right |
|---|---|---|
| Netherite Sword | Breeze Rod | Netherite Axe |

| Bottom Left | Bottom Middle | Bottom Right |
|---|---|---|
| Wind Charge | Empty | Wind Charge |

Requirements:
- The recipe must produce exactly one Godstorm Mace.
- Use a custom recipe key.
- Ensure the ingredients are consumed correctly.
- Prevent normal maces from being created through this recipe.
- The crafted mace must automatically receive all custom abilities and enchantments.

## 5. CUSTOM RESOURCE PACK AND WEAPON TEXTURE

Create a complete custom resource pack for the Godstorm Mace.

Visual requirements:

**Weapon appearance:**
- Main color: Bright electric blue.
- Secondary colors: Dark blue, cyan, and light blue.
- Give the mace a legendary and powerful appearance.
- Add glowing blue patterns and lightning-like details.
- The mace head should look like a powerful magical storm weapon.

**Special visual effects:**
- Blue fire should appear to emit from the mace.
- Add a magical blue energy effect.
- Make the weapon visually distinctive from the vanilla mace.

Technical requirements:
- Use Minecraft's supported resource pack system.
- Implement the appropriate custom model/texture mapping for the target Minecraft version.
- Include all necessary texture files, model files, and pack metadata.
- Make sure the resource pack works with the plugin.
- Provide a ready-to-use resource pack ZIP.

## 6. PLUGIN CONFIGURATION

Create a config.yml containing configurable settings:

- Speed amplifier.
- Regeneration amplifier.
- Launch power.
- Explosion radius.
- Explosion damage.
- Explosion knockback.
- Ability cooldown.
- Particle settings.
- Lightning strike settings.
- Crafting recipe enable/disable.
- Resource pack settings.

Allow server owners to customize these values without modifying Java code.

## 7. COMMANDS

Implement these commands:

/godstorm give [player]
- Gives the Godstorm Mace.

/godstorm reload
- Reloads the plugin configuration.

/godstorm recipe
- Displays the Godstorm Mace crafting recipe.

/godstorm info
- Displays information about the weapon and its abilities.

Add appropriate permission nodes:

- godstorm.admin
- godstorm.give
- godstorm.reload
- godstorm.use

## 8. TECHNICAL REQUIREMENTS

- Minecraft Java Edition.
- Use Java.
- Target Paper API.
- Make the plugin compatible with my specified Minecraft server version.
- Use clean, optimized, and maintainable code.
- Avoid unnecessary repeating tasks.
- Properly manage player data and cooldowns.
- Clean up temporary ability states when players disconnect, die, or change worlds.
- Prevent memory leaks.
- Make all abilities multiplayer-compatible.
- Avoid conflicts with other plugins.
- Do not use NMS unless absolutely necessary.

## 9. DELIVERABLES

I do not want just an explanation or example code.

I want a complete working project containing:

1. Complete Java source code.
2. plugin.yml.
3. config.yml.
4. Maven or Gradle build configuration.
5. Custom crafting recipe implementation.
6. All ability implementations.
7. Custom particle and sound effects.
8. Complete custom resource pack.
9. Custom blue mace textures and models.
10. Installation instructions.

Provide the final compiled plugin as a `.jar` file and the resource pack as a `.zip` file.

## 10. IMPORTANT DEVELOPMENT INSTRUCTIONS

- Write actual functional code, not pseudocode.
- Do not leave TODO comments or unfinished features.
- Do not skip any ability.
- Make sure the crafting recipe matches the exact arrangement above.
- Test for compilation errors.
- Verify API compatibility with the selected Minecraft version.
- If something is not supported by the API, implement a proper alternative.
- Keep the plugin and resource pack compatible with each other.

Before starting development, ask me for my exact Minecraft server version and Paper/Folia server type if they are not specified.

After that, build the complete project and provide all downloadable files.

**FINAL GOAL:** Create an extremely powerful, legendary blue-themed custom Minecraft weapon called GODSTORM MACE, with unique abilities, massive impact explosions, lightning attacks, custom particles, and a beautiful blue-fire texture.
Kodari AI
KodariNov 3 at 7:01 am 1
GodstormMace
A Paper plugin adding a legendary blue-themed custom mace with unique abilities. Features include permanent Speed II and Regeneration I while held, a Sky Launch ability that launches players 10 blocks with particle effects and triggers a massive 5-block explosion on impact with enemies, and a Thunder Strike that summons lightning on melee hits. Includes custom enchantments (Density VII, Breach VII, Wind Burst IV, Mending, Unbreaking VII), a custom crafting recipe using Heavy Core, Breeze Rod, Wind Charges, Netherite Sword and Axe, configurable settings, admin commands, and a custom resource pack with blue electric textures.
  • Set up a Java 21 Paper plugin for 1.21.11 with the Godstorm item, commands, configuration, and exact recipe.

  • Implement the passive effects, player-impact launch, visual-only lightning, and high-level vanilla enchantments.

  • Include installation notes; the custom texture/ready-to-use resource-pack ZIP needs Kodari Studio enabled.

Created the Godstorm Mace Paper plugin for Minecraft 1.21.11. It includes the marked custom item, configured crafting recipe, high-level enchantments, held effects, Sky Launch impact explosion, visual-only lightning, commands, and configuration.

The blue texture and ready-to-use resource-pack ZIP aren’t included because Kodari Studio is disabled for this project. Enable it via Settings → Generation to create the texture assets. The plugin’s config already has resource-pack URL and SHA-1 settings.

To get the plugin JAR, click Compile in the top bar, click Compile in the window, then download the successful build. On a phone, use ⋮ → Compile Project.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
Code
5 611
src/main/java/com/kodari/godstorm/GodstormMacePlugin.java
package com.kodari.godstorm;

import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XPotion;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;

public final class GodstormMacePlugin extends org.bukkit.plugin.java.JavaPlugin implements Listener, CommandExecutor {
    private NamespacedKey maceKey;
    private NamespacedKey recipeKey;
    private final Map<UUID, HeldEffectState> heldEffectStates = new HashMap<>();
    private final Map<UUID, LaunchState> launchStates = new HashMap<>();
    private final Map<UUID, Long> cooldowns = new HashMap<>();
    private int effectTick;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        maceKey = new NamespacedKey(this, "godstorm_mace");
        recipeKey = new NamespacedKey(this, "godstorm_mace");
        Bukkit.getPluginManager().registerEvents(this, this);
        if (getCommand("godstorm") != null) {
            getCommand("godstorm").setExecutor(this);
        }
        refreshRecipe();
        Bukkit.getScheduler().runTaskTimer(this, this::tickLaunches, 1L, 1L);
        Bukkit.getScheduler().runTaskTimer(this, this::tickHeldEffects, 20L, 20L);
    }

    @Override
    public void onDisable() {
        for (Player player : Bukkit.getOnlinePlayers()) {
            restoreHeldEffects(player);
        }
        launchStates.clear();
        cooldowns.clear();
        heldEffectStates.clear();
        Bukkit.removeRecipe(recipeKey);
    }

    private void refreshRecipe() {
        Bukkit.removeRecipe(recipeKey);
        if (!getConfig().getBoolean("crafting.enabled", true)) {
            return;
        }

        ShapedRecipe recipe = new ShapedRecipe(recipeKey, createMace());
        recipe.shape("WCW", "SRA", "W W");
        recipe.setIngredient('W', material("WIND_CHARGE"));
        recipe.setIngredient('C', material("HEAVY_CORE"));
        recipe.setIngredient('S', material("NETHERITE_SWORD"));
        recipe.setIngredient('R', material("BREEZE_ROD"));
        recipe.setIngredient('A', material("NETHERITE_AXE"));
        Bukkit.addRecipe(recipe);
    }

    private Material material(String name) {
        return XMaterial.matchXMaterial(name)
                .map(XMaterial::parseMaterial)
                .orElseThrow(() -> new IllegalStateException("Missing required material: " + name));
    }

    private ItemStack createMace() {
        ItemStack mace = XMaterial.matchXMaterial("MACE").map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Mace material is unavailable"));
        ItemMeta meta = mace.getItemMeta();
        meta.setDisplayName(color("&b&lGODSTORM MACE"));
        meta.setLore(List.of(
                color("&7Legendary Storm Weapon"),
                color("&9Grants Speed II and Regeneration I while held"),
                color("&bSneak + right-click to unleash a Sky Launch"),
                color("&3Strikes foes with divine lightning")
        ));
        meta.getPersistentDataContainer().set(maceKey, PersistentDataType.BYTE, (byte) 1);
        mace.setItemMeta(meta);
        addUnsafeEnchantment(mace, "DENSITY", 7);
        addUnsafeEnchantment(mace, "BREACH", 7);
        addUnsafeEnchantment(mace, "WIND_BURST", 4);
        addUnsafeEnchantment(mace, "MENDING", 1);
        addUnsafeEnchantment(mace, "UNBREAKING", 7);
        return mace;
    }

    private void addUnsafeEnchantment(ItemStack item, String name, int level) {
        XEnchantment.matchXEnchantment(name).ifPresent(enchantment -> item.addUnsafeEnchantment(enchantment.getEnchant(), level));
    }

    private boolean isGodstormMace(ItemStack item) {
        return item != null && item.hasItemMeta()
                && item.getItemMeta().getPersistentDataContainer().has(maceKey, PersistentDataType.BYTE);
    }

    private boolean isHoldingMace(Player player) {
        return isGodstormMace(player.getInventory().getItemInMainHand())
                || isGodstormMace(player.getInventory().getItemInOffHand());
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent event) {
        Action action = event.getAction();
        if ((action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK)
                || !event.getPlayer().isSneaking() || !isHoldingMace(event.getPlayer())) {
            return;
        }

        Player player = event.getPlayer();
        if (!player.hasPermission("godstorm.use")) {
            return;
        }
        long now = System.currentTimeMillis();
        Long readyAt = cooldowns.get(player.getUniqueId());
        if (readyAt != null && readyAt > now) {
            player.sendMessage(color("&bGodstorm is recharging for &f" + Math.max(1, (readyAt - now + 999) / 1000) + "&b seconds."));
            return;
        }

        event.setCancelled(true);
        int cooldownSeconds = Math.max(0, getConfig().getInt("launch.cooldown-seconds", 8));
        if (cooldownSeconds > 0) {
            cooldowns.put(player.getUniqueId(), now + cooldownSeconds * 1000L);
        }
        launchStates.put(player.getUniqueId(), new LaunchState(
                Math.max(1, getConfig().getInt("launch.duration-ticks", 100)), player.getWorld()));
        Vector velocity = player.getVelocity();
        velocity.setY(getConfig().getDouble("launch.vertical-power", 2.2));
        player.setVelocity(velocity);
        playSound(player.getWorld(), player.getLocation(), getConfig().getString("sounds.activation", "ENTITY_LIGHTNING_BOLT_THUNDER"), 1.8f, 0.8f);
        emitLaunchParticles(player.getLocation());
    }

    @EventHandler
    public void onMeleeHit(EntityDamageByEntityEvent event) {
        if (!(event.getDamager() instanceof Player attacker) || !(event.getEntity() instanceof LivingEntity target)
                || !attacker.hasPermission("godstorm.use") || !isHoldingMace(attacker)
                || !getConfig().getBoolean("thunder-strike.enabled", true)) {
            return;
        }
        Location location = target.getLocation().add(0, Math.max(0.2, target.getHeight() * 0.5), 0);
        target.getWorld().strikeLightningEffect(location);
        spawnParticle(target.getWorld(), location, "ELECTRIC_SPARK", getConfig().getInt("particles.lightning-count", 18), 0.35);
        playSound(target.getWorld(), location, getConfig().getString("sounds.thunder-strike", "ENTITY_LIGHTNING_BOLT_THUNDER"), 1.2f, 1.1f);
    }

    @EventHandler
    public void onQuit(PlayerQuitEvent event) {
        Player player = event.getPlayer();
        restoreHeldEffects(player);
        launchStates.remove(player.getUniqueId());
        cooldowns.remove(player.getUniqueId());
    }

    @EventHandler
    public void onDeath(PlayerDeathEvent event) {
        Player player = event.getEntity();
        restoreHeldEffects(player);
        launchStates.remove(player.getUniqueId());
    }

    @EventHandler
    public void onWorldChange(PlayerChangedWorldEvent event) {
        Player player = event.getPlayer();
        restoreHeldEffects(player);
        launchStates.remove(player.getUniqueId());
    }