philipx8x.

NG1ZQP

📎 1 file 1,067 chars
📄
pasted-code-1768921979241.txt
txt 43 lines
▶
Prompt (English):

You are an experienced Minecraft plugin developer specialized in Spigot/Paper (Java).

Create a plugin that adds the command /build .

Functionality:

A player executes a command like /build medieval_house

The plugin automatically builds the selected structure at the player’s current location

The structure should use thematically appropriate blocks (e.g. wood, stone, stairs for the roof)

The building process should be logical (foundation → walls → roof)

Technical requirements:

Target version: Minecraft 1.20+

API: Paper or Spigot

Clean, well-commented Java code

A complete plugin.yml including the command and description

Proper error handling (unknown structure, not enough space, etc.)

Extensibility:

Structures must be easy to extend (e.g. via enums or structure classes)

Include at least one example structure: medieval_house

Output:

Full source code

Short explanation of the main classes

Instructions on how to compile and install the plugin

Respond with only the code and the explanation, no unnecessary text.
Kodari AI
KodariJan 20 at 3:13 pm 6,348 (v2)

I’ll create a structure building plugin with extensible architecture and automated construction.

StructureBuilder
An automated structure building system that allows players to instantly construct predefined buildings at their location. Features a command-based interface with /build for placing structures like medieval houses. Includes a logical building process (foundation, walls, roof), extensible structure system via abstract classes, and cross-version block compatibility. Supports error handling for invalid structures and location validation.

Structure Overview

Core Classes

StructureBuilder.java - Main plugin class that initializes the StructureManager and registers commands

StructureManager.java - Central registry for all structures, handles registration and retrieval

Structure.java - Interface defining the contract for all buildable structures with three phases (foundation, walls, roof)

BlockData.java - Immutable data class holding block position and material using XSeries for cross-version compatibility

MedievalHouse.java - Example structure implementation featuring:

  • 7x9 cobblestone foundation

  • Stone brick/cobblestone walls with oak door and glass pane windows

  • Oak stairs roof with peak design

  • Oak plank ceiling

BuildCommand.java - Command handler with tab completion and permission checks

StructureBuildTask.java - Async task that places 5 blocks per tick with sound effects for smooth visual building

Extension Guide

Add new structures by:

  1. Create class in structure/impl/ implementing Structure

  2. Define getFoundation(), getWalls(), getRoof() methods returning List<BlockData>

  3. Register in StructureManager.registerDefaultStructures()

Compilation & Installation

Shell
./gradlew build

Output: build/libs/StructureBuilder-1.0.0.jar

Place in server plugins/ folder and restart.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 389
src/main/java/com/structurebuilder/StructureBuilder.java
package com.structurebuilder;

import com.structurebuilder.command.BuildCommand;
import com.structurebuilder.manager.StructureManager;
import org.bukkit.plugin.java.JavaPlugin;

public class StructureBuilder extends JavaPlugin {
    private StructureManager structureManager;
    
    @Override
    public void onEnable() {
        this.structureManager = new StructureManager();
        
        getCommand("build").setExecutor(new BuildCommand(this));
        
        getLogger().info("StructureBuilder enabled with " + structureManager.getStructureCount() + " structures");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("StructureBuilder disabled");
    }
    
    public StructureManager getStructureManager() {
        return structureManager;
    }
}