K
📎 1 file 3,001 chars
📄
pasted-code-1774345153339.txt
txt 140 lines
▶
====================================
4. MINI SHOP HUB SYSTEM (INTERNAL)
====================================

Create a SMALL, MODERN, FANCY shop hub system inside the Auction House plugin.

This is NOT a big town — it is a compact, high-quality hub with 3–4 shops.

------------------------------------
COMMANDS
------------------------------------

/townsell spawn  
/townsell despawn  

- ONLY OP players can use these commands

------------------------------------
SPAWN SYSTEM
------------------------------------

When running:
/townsell spawn

The plugin must:
1. Build the hub structure instantly
2. Register a protected region
3. Spawn all NPCs
4. Connect NPCs to shop GUIs

------------------------------------
DESPAWN SYSTEM
------------------------------------

When running:
/townsell despawn

The plugin must:
- Remove all placed blocks from the hub
- Remove all spawned NPCs
- Remove the protected region
- Clean up all data related to the hub

------------------------------------
STRUCTURE SYSTEM
------------------------------------

- The hub must be built internally (NO WorldEdit)
- Use predefined block placement or structure builder system
- Must be optimized to avoid lag

Design:
- Modern, clean, visually appealing
- Small central area
- 3–4 shop stands around it
- Use good block palette (stone, wood, slabs, lighting, etc.)

------------------------------------
PROTECTION SYSTEM
------------------------------------

- Create internal region protection
- Prevent:
  - block breaking
  - block placing
- Allow OP/admin bypass

------------------------------------
NPC SYSTEM
------------------------------------

Use Villagers or ArmorStands

Each NPC:
- Has custom name
- Has clean appearance
- On right-click → opens INVENTORY GUI shop

NPC types:

🗡️ Blacksmith → weapons  
🛡️ Armor Shop → armor  
🍖 Food Shop → food  
🏹 Ranged Shop → bows/arrows  

------------------------------------
SHOP SYSTEM (IMPORTANT)
------------------------------------

- INVENTORY GUI-based shops
- Uses diamond balance from Auction House plugin

Items must be GOOD (not basic only):

Food:
- Steak
- Golden apples
- Cooked chicken
- Bread bundles
- Better food options

Weapons:
- Iron swords
- Diamond swords
- Enchanted swords

Armor:
- Iron armor
- Diamond armor
- Enchanted armor

Ranged:
- Bows
- Arrows
- Enchanted bows

------------------------------------
CONFIGURATION
------------------------------------

Allow full customization:

- Hub spawn location
- Enable/disable protection
- NPC positions
- Items sold
- Prices
- INVENTORY GUI titles and layout

------------------------------------
OUTPUT REQUIRED
------------------------------------

- Structure layout plan (positions of shops)
- Block placement/build system
- NPC system design
- INVENTORY GUI shop system
- Plugin class structure
- Event handling flow
- Config.yml example
Kodari AI
KodariMar 24 at 9:42 am 25,582 (v2)

I’ll create a modern mini shop hub system with spawnable structures, NPC vendors, and GUI-based shops.

TownSellHub
A compact shop hub system with spawnable structures, NPC vendors, and GUI-based shops. Features instant hub deployment with /townsell spawn, internal region protection, and customizable inventory-based shops. Includes a diamond economy system with four themed vendors: Blacksmith, Armor Shop, Food Shop, and Ranged Shop. Perfect for survival servers wanting a centralized trading area with full configuration support.

Modern mini shop hub system created with instant spawn/despawn, NPC vendors, GUI shops, and diamond economy. Use /townsell spawn to build the hub and /townsell despawn to remove it.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
27 1,788
src/main/java/com/townsellhub/TownSellHub.java
package com.townsellhub;

import com.townsellhub.command.TownSellCommand;
import com.townsellhub.inventory.gui.GUIListener;
import com.townsellhub.inventory.gui.GUIManager;
import com.townsellhub.listener.NPCInteractListener;
import com.townsellhub.listener.ProtectionListener;
import com.townsellhub.manager.ConfigManager;
import com.townsellhub.manager.DiamondEconomy;
import com.townsellhub.manager.HubManager;
import com.townsellhub.manager.NPCManager;
import com.townsellhub.manager.RegionProtection;
import com.townsellhub.manager.ShopManager;
import com.townsellhub.manager.StructureBuilder;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class TownSellHub extends JavaPlugin {
    
    private ConfigManager configManager;
    private DiamondEconomy diamondEconomy;
    private StructureBuilder structureBuilder;
    private RegionProtection regionProtection;
    private NPCManager npcManager;
    private ShopManager shopManager;
    private HubManager hubManager;
    private GUIManager guiManager;
    
    @Override
    public void onEnable() {
        this.saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        this.diamondEconomy = new DiamondEconomy(this);
        this.structureBuilder = new StructureBuilder(this);
        this.regionProtection = new RegionProtection(this);
        this.npcManager = new NPCManager(this);
        this.shopManager = new ShopManager(this);
        this.guiManager = new GUIManager();
        this.hubManager = new HubManager(this);
        
        this.getCommand("townsell").setExecutor(new TownSellCommand(this));
        
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
        Bukkit.getPluginManager().registerEvents(new ProtectionListener(this), this);
        Bukkit.getPluginManager().registerEvents(new NPCInteractListener(this), this);
        
        this.hubManager.loadHub();
        
        this.getLogger().info("TownSellHub enabled successfully!");
    }
    
    @Override
    public void onDisable() {
        if (this.hubManager != null) {
            this.hubManager.saveHub();
        }
        if (this.npcManager != null) {
            this.npcManager.removeAllNPCs();
        }
        this.getLogger().info("TownSellHub disabled successfully!");
    }
}