arifiz77_06727

Create a complete Minecraft plugin using Java and the Spigot/Paper MC (version 1.21.4+).

Plugin Name: GLOXY_SMP

Requirements:

  1. Add 5 custom weapons with unique abilities:
  • Thunder Trident (Material: TRIDENT)

Main Ability: When thrown, it creates chain lightning that damages nearby enemies.

Secondary Ability (SHIFT + RIGHT CLICK): "Storm Surge" — launches the player slightly upward and strikes lightning multiple times around the target area. Include electric spark and cloud particles.

  • TNT Bow (Material: BOW)

Main Ability: Arrows explode on impact.

Secondary Ability (SHIFT + RIGHT CLICK): "Carpet Bomb" — shoots multiple arrows into the sky that fall and explode in a radius. Include flame and smoke particles.

  • Dragon Slayer Sword (Material: NETHERITE_SWORD)

Main Ability: High damage weapon (higher than default netherite sword).

Secondary Ability (SHIFT + RIGHT CLICK): "Dragon Roar" — deals area damage in a cone, applies knockback, and uses dragon breath-style particles.

  • Oak Jude (Material: IRON_AXE)

Main Ability: Pulls enemies toward the player on hit.

Secondary Ability (SHIFT + RIGHT CLICK): "Nature Grasp" — roots nearby enemies in place for a few seconds and applies poison. Include green particle effects like leaves.

  • Wither Scythe (Material: NETHERITE_AXE)

Main Ability: On kill, heals the player (life steal).

Secondary Ability (SHIFT + RIGHT CLICK): "Soul Burst" — damages nearby enemies and heals the player using a dark energy effect. Include smoke and soul-like particles.

  1. Detect custom weapons using display names (use colored names for each weapon).
  1. Implement SHIFT + RIGHT CLICK detection using PlayerInteractEvent.
  1. Add particle effects to all abilities (use Spigot Particle API).
  1. Add sound effects for each ability (lightning, explosion, dragon growl, etc.).
  1. Implement cooldown system (10–20 seconds per ability) to prevent spam.
  1. Prevent friendly fire if needed (optional toggle).
  1. Organize code into clean classes (Main class + Ability classes).
  1. Include plugin.yml file.
  1. Register all events properly.
  1. Add basic config.yml for:
  • cooldown time
  • damage values
  • explosion power
  1. Make the code optimized, beginner-friendly, and well-commented.
  1. Ensure no errors (null checks, safe casting, etc.).

Output:

  • Full Java source code
  • plugin.yml
  • config.yml
  • Instructions on how to compile and install the plugin
Kodari AI
KodariApr 11 at 3:20 pm 53,537 (v2)
GloxySMP
A custom weapons plugin for GLOXY SMP featuring 5 unique weapons: Thunder Trident (chain lightning + Storm Surge), TNT Bow (explosive arrows + Carpet Bomb), Dragon Slayer Sword (bonus damage + Dragon Roar cone), Oak Jude Axe (enemy pull + Nature Grasp root/poison), and Wither Scythe (life steal + Soul Burst drain). Each weapon has a SHIFT+RIGHT-CLICK secondary ability with particle effects, sounds, and configurable cooldowns/damage via config.yml.

Let me plan everything before writing:

  • 5 weapons, each with a main passive ability + shift-right-click secondary

  • Managers: ConfigManager, CooldownManager, WeaponManager (includes projectile tracking)

  • Listeners: WeaponListener (hit/kill events) and AbilityListener (shift+right-click)

  • WeaponType enum holds display names and material keys

  • All projectile tracking lives in WeaponManager so both listeners can access it

  • XSeries for all materials, enchantments, sounds, particles — never raw Bukkit enums

New project — creating all files from scratch.


All 11 files created. Here’s a summary of everything:


📁 Project Structure

Plain Text
GloxySMP/
├── build.gradle
├── settings.gradle
└── src/main/
    ├── resources/
    │   ├── plugin.yml
    │   └── config.yml
    └── java/com/gloxysmp/
        ├── GloxyPlugin.java
        ├── WeaponType.java
        ├── manager/
        │   ├── ConfigManager.java
        │   ├── CooldownManager.java
        │   └── WeaponManager.java
        └── listener/
            ├── WeaponListener.java
            └── AbilityListener.java

⚔️ Weapon Summary

Weapon
Material
Main Ability
Secondary (Sneak + RC)
§b§lThunder Trident
TRIDENT
Chain lightning arcs to 8-block radius on throw
Storm Surge — launch upward + 6 lightning strikes
§c§lTNT Bow
BOW
Arrows explode on impact
Carpet Bomb — 7 explosive arrows lobbed skyward
§4§lDragon Slayer Sword
NETHERITE_SWORD
+4 bonus damage per hit
Dragon Roar — 60° cone AoE + knockback
§a§lOak Jude
IRON_AXE
Pulls hit enemies toward you
Nature Grasp — root (Slowness 255) + Poison nearby
§8§lWither Scythe
NETHERITE_AXE
Heals +3 HP per kill
Soul Burst — drain life from ALL nearby enemies

🔧 How to Compile & Install

1. Requirements

  • Java 21+ (JDK)

  • Internet connection (Gradle auto-downloads dependencies)

2. Build

Shell
# Navigate to the project folder
cd GloxySMP

# Build the JAR (Windows)
gradlew.bat jar

# Build the JAR (Linux / Mac)
./gradlew jar

The compiled JAR will appear in build/libs/GloxySMP-1.0.0.jar

3. Install

  • Drop GloxySMP-1.0.0.jar into your server’s plugins/ folder

  • Restart the server

  • The plugins/GloxySMP/config.yml will be auto-generated

4. Get Weapons In-Game

Plain Text
/gloxy give thunder-trident
/gloxy give tnt-bow
/gloxy give dragon-slayer
/gloxy give oak-jude
/gloxy give wither-scythe

# Give to another player
/gloxy give wither-scythe Steve

Requires OP or the gloxy.admin permission node.


⚙️ config.yml Highlights

Key
Default
Description
friendly-fire
false
AoE abilities skip other players when false
cooldowns.*
10–15s
Per-weapon secondary ability cooldown
damage.dragon-slayer-bonus
4.0
Bonus damage added each sword hit
explosion.tnt-bow-power
2.0
Explosion radius for single TNT arrow
radius.chain-lightning
8.0
Block radius of Thunder Trident chain effect
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
11 1,071
src/main/java/com/gloxysmp/GloxyPlugin.java
package com.gloxysmp;

import com.gloxysmp.listener.AbilityListener;
import com.gloxysmp.listener.WeaponListener;
import com.gloxysmp.manager.ConfigManager;
import com.gloxysmp.manager.CooldownManager;
import com.gloxysmp.manager.WeaponManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class GloxyPlugin extends JavaPlugin {

    private ConfigManager configManager;
    private CooldownManager cooldownManager;
    private WeaponManager weaponManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.configManager = new ConfigManager(this);
        this.cooldownManager = new CooldownManager();
        this.weaponManager = new WeaponManager(this);

        getServer().getPluginManager().registerEvents(new WeaponListener(this), this);
        getServer().getPluginManager().registerEvents(new AbilityListener(this), this);

        getLogger().info("GLOXY SMP Custom Weapons loaded successfully!");
        getLogger().info("5 custom weapons are ready to be discovered.");
    }

    @Override
    public void onDisable() {
        getLogger().info("GLOXY SMP disabled.");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!command.getName().equalsIgnoreCase("gloxy")) return false;

        if (args.length == 0) {
            sender.sendMessage("§6§lGLOXY SMP §r§7— Custom Weapons Plugin");
            sender.sendMessage("§7Usage: §e/gloxy give <weapon> [player]");
            sender.sendMessage("§7Weapons: §ethunder-trident§7, §etnt-bow§7, §edragon-slayer§7, §eoak-jude§7, §ewither-scythe");
            return true;
        }

        if (!args[0].equalsIgnoreCase("give")) {
            sender.sendMessage("§cUnknown subcommand. Use §e/gloxy give <weapon> [player]");
            return true;
        }

        if (!sender.hasPermission("gloxy.admin")) {
            sender.sendMessage("§cYou do not have permission to use this command.");
            return true;
        }

        if (args.length < 2) {
            sender.sendMessage("§cUsage: §e/gloxy give <weapon> [player]");
            sender.sendMessage("§7Weapons: §ethunder-trident§7, §etnt-bow§7, §edragon-slayer§7, §eoak-jude§7, §ewither-scythe");
            return true;
        }

        Player target = null;
        if (args.length >= 3) {
            target = Bukkit.getPlayer(args[2]);
            if (target == null) {
                sender.sendMessage("§cPlayer '§e" + args[2] + "§c' not found or offline.");
                return true;
            }
        } else if (sender instanceof Player p) {
            target = p;
        } else {
            sender.sendMessage("§cConsole must specify a player: §e/gloxy give <weapon> <player>");
            return true;
        }

        WeaponType type = resolveWeaponType(args[1]);
        if (type == null) {
            sender.sendMessage("§cUnknown weapon '§e" + args[1] + "§c'.");
            sender.sendMessage("§7Available: §ethunder-trident§7, §etnt-bow§7, §edragon-slayer§7, §eoak-jude§7, §ewither-scythe");
            return true;
        }

        ItemStack weapon = weaponManager.createWeapon(type);
        if (weapon == null) {
            sender.sendMessage("§cFailed to create weapon. Check server version compatibility.");
            return true;
        }

        target.getInventory().addItem(weapon);
        target.sendMessage("§aYou received: " + type.getDisplayName() + " §a§l✔");
        if (!target.equals(sender)) {
            sender.sendMessage("§aGave §r" + type.getDisplayName() + " §ato §e" + target.getName() + "§a.");
        }
        return true;
    }

    private WeaponType resolveWeaponType(String arg) {
        return switch (arg.toLowerCase().replace("_", "-")) {
            case "thunder-trident", "trident", "thunder" -> WeaponType.THUNDER_TRIDENT;
            case "tnt-bow", "bow", "tnt" -> WeaponType.TNT_BOW;
            case "dragon-slayer", "dragon-slayer-sword", "sword", "dragon" -> WeaponType.DRAGON_SLAYER;
            case "oak-jude", "oakjude", "axe", "oak" -> WeaponType.OAK_JUDE;
            case "wither-scythe", "witherscythe", "scythe", "wither" -> WeaponType.WITHER_SCYTHE;
            default -> null;
        };
    }
}