hunterjutt4
📎 1 file 1,095 chars
📄
pasted-code-1773064826472.txt
txt 51 lines
▶
Create a complete Minecraft Spigot/Paper plugin called "GuardArmy".

Requirements:

1. The plugin must allow players to craft guard spawn items such as:
- Swordsman
- Archer
- Miner
- Knight

2. Players can spawn multiple guards that belong to them.

3. Guards should have AI behaviors:
- follow the player
- attack hostile mobs
- stay in place
- patrol an area
- mine blocks (for miner guards)

4. Guards should have an inventory INVENTORY GUI where players can:
- give armor
- give weapons
- give tools
- store items

5. The INVENTORY GUI should open with a command:
 /guard menu

6. All guard stats must be configurable in config.yml:
- health
- damage
- speed
- equipment
- guard limits per player

7. Crafting recipes for guards must be fully configurable in config.yml.

8. The plugin must support multiple guards per player and track ownership.

9. Guards should teleport to their owner if they are too far away.

10. The plugin must include:
- main Java class
- plugin.yml
- config.yml
- commands
- listeners
- guard AI manager
- INVENTORY GUI system

Target version: Spigot/Paper 1.21+.
Kodari AI
KodariMar 9 at 2:03 pm 23,825 (v2)

I’ll create a complete GuardArmy plugin with a GUI-based inventory system, multiple guard types, AI behaviors, and full configuration support.

GuardArmy
A comprehensive guard management system allowing players to craft, spawn, and command personal guards. Features multiple guard types (Swordsman, Archer, Miner, Knight) with customizable AI behaviors including follow, attack, patrol, and mining. Includes an inventory GUI for equipping guards with armor, weapons, and tools. All stats, behaviors, and crafting recipes are fully configurable.

Analysis

  • Creating GUI-based guard management system with inventory interface

  • Using documentation’s inventory framework with button handlers

  • Guards are Villagers with persistent data and custom AI

  • All features configurable (stats, recipes, limits)

Complete GuardArmy plugin created with all requested features including GUI-based inventory system, multiple guard types with AI behaviors, configurable stats and crafting recipes, and full command support.

hunterjutt4

make it more enhance to spawn with commands and it really works it showing guard not found make it more pricize and INVENTORY GUI is also not opening fix and make commands to spawn guards and give them enchanted netherite gear prot 4

Kodari AI
KodariMar 9 at 2:50 pm 22,414 (v2)

I’ll analyze the current implementation and fix the spawning issues, GUI problems, and enhance the commands to spawn guards with enchanted netherite gear.

I’ll fix the guard spawning issues, add direct spawn commands, and implement enchanted netherite gear with Protection 4.

All issues have been fixed and enhanced:

  1. Direct spawn command: Use /guard spawn <type> to spawn guards (SWORDSMAN, ARCHER, KNIGHT, MINER)

  2. Enchanted netherite gear: All guards now have full Protection 4 netherite armor with enhanced weapons

  3. Fixed guard finding: Improved search logic to properly detect guards within 15 blocks

  4. Added list command: /guard list shows all your active guards

  5. Tab completion: Auto-complete for all commands and guard types

  6. Better error messages: Clear feedback when guards aren’t found

The guards now spawn with:

  • Netherite armor (Protection 4, Unbreaking 3, Feather Falling 4)

  • Enhanced weapons (Sharpness 5, Power 5, Efficiency 5, etc.)

  • Increased stats (better health, damage, and speed)

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
21 1,877
src/main/java/com/guardarmy/GuardArmy.java
package com.guardarmy;

import com.guardarmy.commands.GuardCommand;
import com.guardarmy.inventory.gui.GUIListener;
import com.guardarmy.inventory.gui.GUIManager;
import com.guardarmy.listeners.CraftListener;
import com.guardarmy.listeners.GuardListener;
import com.guardarmy.managers.ConfigManager;
import com.guardarmy.managers.DataManager;
import com.guardarmy.managers.GuardAIManager;
import com.guardarmy.managers.GuardManager;
import com.guardarmy.models.GuardType;
import com.cryptomorin.xseries.XMaterial;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
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.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class GuardArmy extends JavaPlugin implements Listener {
    private ConfigManager configManager;
    private DataManager dataManager;
    private GuardManager guardManager;
    private GuardAIManager guardAIManager;
    private GUIManager guiManager;
    
    private NamespacedKey guardTypeKey;
    
    @Override
    public void onEnable() {
        this.guardTypeKey = new NamespacedKey(this, "guard_spawn_type");
        
        this.configManager = new ConfigManager(this);
        this.dataManager = new DataManager(this);
        this.guardManager = new GuardManager(this, configManager, dataManager);
        this.guardAIManager = new GuardAIManager(this, guardManager, configManager);
        this.guiManager = new GUIManager();
        
        registerCommands();
        registerListeners();
        
        getLogger().info("GuardArmy has been enabled!");
        getLogger().info("Version: " + getDescription().getVersion());
    }
    
    @Override
    public void onDisable() {
        if (guardManager != null) {
            guardManager.clearAll();
        }
        
        if (dataManager != null) {
            dataManager.clearAll();
        }
        
        getLogger().info("GuardArmy has been disabled!");
    }
    
    private void registerCommands() {
        GuardCommand guardCommand = new GuardCommand(this, guiManager, guardManager);
        getCommand("guard").setExecutor(guardCommand);
        getCommand("guard").setTabCompleter(guardCommand);
    }
    
    private void registerListeners() {
        GUIListener guiListener = new GUIListener(guiManager);
        Bukkit.getPluginManager().registerEvents(guiListener, this);
        
        GuardListener guardListener = new GuardListener(this, guardManager, guiManager);
        Bukkit.getPluginManager().registerEvents(guardListener, this);
        
        CraftListener craftListener = new CraftListener(this, configManager);
        Bukkit.getPluginManager().registerEvents(craftListener, this);
        
        Bukkit.getPluginManager().registerEvents(this, this);
    }
    
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) {
            return;
        }
        
        Player player = event.getPlayer();
        ItemStack item = event.getItem();
        
        if (item == null || item.getItemMeta() == null) {
            return;
        }
        
        if (!item.getItemMeta().getPersistentDataContainer().has(guardTypeKey, PersistentDataType.STRING)) {
            return;
        }
        
        String typeString = item.getItemMeta().getPersistentDataContainer()
            .get(guardTypeKey, PersistentDataType.STRING);
        
        if (typeString == null) {
            return;
        }
        
        GuardType type;
        try {
            type = GuardType.valueOf(typeString);
        } catch (IllegalArgumentException e) {
            return;
        }
        
        if (!player.hasPermission("guardarmy.spawn")) {
            player.sendMessage(ChatColor.translateAlternateColorCodes('&',
                configManager.getMessage("no-permission")));
            event.setCancelled(true);
            return;
        }
        
        guardManager.spawnGuard(player, type, player.getLocation());
        
        item.setAmount(item.getAmount() - 1);
        event.setCancelled(true);
    }
}