little monster

the megastructure from BLAME!

Kodari AI
KodariOct 14 at 11:45 am 2
MegaStructureGuard
A Minecraft plugin that generates and protects massive, procedurally-built megastructures inspired by the futuristic cityscapes of BLAME!. Players can discover towering vertical megacities, sprawling industrial complexes, and labyrinthine underground networks generated across the world. The plugin features region-based protection, allowing players to claim and manage sections of these colossal structures. Includes configurable generation parameters, biome-specific structure variants, and a comprehensive GUI for managing claimed territories. Structures feature functional elements like elevators, automated doors, and lighting systems. Players can form factions to collectively defend and expand their megastructure claims against griefers and mobs. The plugin integrates with WorldGuard for seamless protection compatibility and offers performance-optimized chunk loading for large-scale builds.

I’ll build a /megastructure plugin that fills an area with a BLAME!-style gray lattice: stacked floors, a column grid, ceiling beams, and lights. It builds in batches so the server doesn’t freeze.

* Begin Patch * Add File: src/main/resources/plugin.yml +name: Megastructure +version: 1.0.0 +main: com.kodari.megastructure.MegastructurePlugin +author: Kodari +description: Builds a vast BLAME!-inspired gray lattice megastructure. +commands:

  • megastructure:

  • description: Build or cancel the megastructure.

  • usage: /megastructure <build|cancel>

  • aliases: [mega] +permissions:

  • megastructure.build:

  • description: Build and cancel the megastructure.

  • default: op * Add File: src/main/resources/config.yml +# Footprint of the megastructure in blocks (X and Z) and total height (Y) +width: 160 +depth: 160 +height: 96

+# Horizontal floor layers +floor-spacing: 16 +floor-thickness: 2 + +# Column grid and ceiling beams +pillar-spacing: 32 +pillar-thickness: 4 + +# Blocks placed per server tick (lower = less lag, slower build) +blocks-per-tick: 4000 + +# Materials (XSeries names, falls back to STONE / SEA_LANTERN if unavailable) +floor-material: GRAY_CONCRETE +pillar-material: POLISHED_ANDESITE +light-material: SEA_LANTERN * Add File: src/main/java/com/kodari/megastructure/MegastructurePlugin.java +package com.kodari.megastructure; + +import org.bukkit.plugin.java.JavaPlugin; + +public class MegastructurePlugin extends JavaPlugin { +

  • private MegastructureBuilder activeBuild;

  • @Override

  • public void onEnable() {

  • Plain Text
       saveDefaultConfig();
    
  • Plain Text
       MegastructureCommand executor = new MegastructureCommand(this);
    
  • Plain Text
       getCommand("megastructure").setExecutor(executor);
    
  • Plain Text
       getCommand("megastructure").setTabCompleter(executor);
    
  • }

  • public MegastructureBuilder getActiveBuild() {

  • Plain Text
       return activeBuild;
    
  • }

  • public void setActiveBuild(MegastructureBuilder activeBuild) {

  • Plain Text
       this.activeBuild = activeBuild;
    
  • } +} * Add File: src/main/java/com/kodari/megastructure/MegastructureCommand.java +package com.kodari.megastructure;

+import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class MegastructureCommand implements CommandExecutor, TabCompleter { +

  • private static final List<String> SUBCOMMANDS = Arrays.asList(“build”, “cancel”);

  • private static final String PERMISSION = “megastructure.build”;

  • private final MegastructurePlugin plugin;

  • public MegastructureCommand(MegastructurePlugin plugin) {

  • Plain Text
       this.plugin = plugin;
    
  • }

  • @Override

  • public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

  • Plain Text
       if (args.length == 0) {
    
  • Plain Text
           sendUsage(sender);
    
  • Plain Text
           return true;
    
  • }

  • Plain Text
       switch (args[0].toLowerCase()) {
    
  • Plain Text
           case "build":
    
  • Plain Text
               handleBuild(sender);
    
  • Plain Text
               break;
    
  • Plain Text
           case "cancel":
    
  • Plain Text
               handleCancel(sender);
    
  • Plain Text
               break;
    
  • default:

  • Plain Text
               sendUsage(sender);
    
  • Plain Text
               break;
    
  • }

  • Plain Text
       return true;
    
  • }

  • private void handleBuild(CommandSender sender) {

  • Plain Text
       if (!(sender instanceof Player)) {
    
  • Plain Text
           sender.sendMessage(ChatColor.RED + "Only players can start a build.");
    
  • Plain Text
           return;
    
  • }

  • Plain Text
       Player player = (Player) sender;
    
  • Plain Text
       if (!player.hasPermission(PERMISSION)) {
    
  • Plain Text
           player.sendMessage(ChatColor.RED + "You don't have permission to do that.");
    
  • Plain Text
           return;
    
  • }

  • Plain Text
       if (plugin.getActiveBuild() != null) {
    
  • Plain Text
           player.sendMessage(ChatColor.RED + "A megastructure is already being built. Use /megastructure cancel to stop it.");
    
  • Plain Text
           return;
    
  • }

  • Plain Text
       new MegastructureBuilder(plugin, player).start();
    
  • }

  • private void handleCancel(CommandSender sender) {

  • Plain Text
       if (!sender.hasPermission(PERMISSION)) {
    
  • Plain Text
           sender.sendMessage(ChatColor.RED + "You don't have permission to do that.");
    
  • Plain Text
           return;
    
  • }

  • Plain Text
       MegastructureBuilder active = plugin.getActiveBuild();
    
  • Plain Text
       if (active == null) {
    
  • Plain Text
           sender.sendMessage(ChatColor.RED + "No megastructure build is running.");
    
  • Plain Text
           return;
    
  • }

  • Plain Text
       active.abort();
    
  • }

  • private void sendUsage(CommandSender sender) {

  • Plain Text
       sender.sendMessage(ChatColor.YELLOW + "Usage: /megastructure <build|cancel>");
    
  • }

  • @Override

  • public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {

  • Plain Text
       List<String> result = new ArrayList<>();
    
  • Plain Text
       if (args.length == 1) {
    
  • Plain Text
           String prefix = args[0].toLowerCase();
    
  • Plain Text
           for (String sub : SUBCOMMANDS) {
    
  • Plain Text
               if (sub.startsWith(prefix)) {
    
  • Plain Text
                   result.add(sub);
    
  • }

  • }

  • }

  • Plain Text
       return result;
    
  • } +} * Add File: src/main/java/com/kodari/megastructure/MegastructureBuilder.java +package com.kodari.megastructure;

+import com.cryptomorin.xseries.XMaterial; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +public class MegastructureBuilder extends BukkitRunnable { +

  • private final MegastructurePlugin plugin;

  • private final Player requester;

  • private final World world;

  • private final int originX;

  • private final int originY;

  • private final int originZ;

  • private final int width;

  • private final int depth;

  • private final int height;

  • private final int floorSpacing;

  • private final int floorThickness;

  • private final int pillarSpacing;

  • private final int pillarThickness;

  • private final int blocksPerTick;

  • private final Material floorMaterial;

  • private final Material pillarMaterial;

  • private final Material lightMaterial;

  • private final long total;

  • private long cursor;

  • private int nextReportPercent = 10;

  • public MegastructureBuilder(MegastructurePlugin plugin, Player requester) {

  • Plain Text
       this.plugin = plugin;
    
  • Plain Text
       this.requester = requester;
    
  • Plain Text
       this.world = requester.getWorld();
    
  • Plain Text
       FileConfiguration cfg = plugin.getConfig();
    
  • Plain Text
       this.width = Math.max(8, cfg.getInt("width", 160));
    
  • Plain Text
       this.depth = Math.max(8, cfg.getInt("depth", 160));
    
  • Plain Text
       this.floorSpacing = Math.max(4, cfg.getInt("floor-spacing", 16));
    
  • Plain Text
       this.floorThickness = Math.max(1, Math.min(cfg.getInt("floor-thickness", 2), floorSpacing - 2));
    
  • Plain Text
       this.pillarSpacing = Math.max(6, cfg.getInt("pillar-spacing", 32));
    
  • Plain Text
       this.pillarThickness = Math.max(1, Math.min(cfg.getInt("pillar-thickness", 4), pillarSpacing / 2 - 1));
    
  • Plain Text
       this.blocksPerTick = Math.max(100, cfg.getInt("blocks-per-tick", 4000));
    
  • Plain Text
       this.floorMaterial = resolveMaterial(cfg.getString("floor-material", "GRAY_CONCRETE"), Material.STONE);
    
  • Plain Text
       this.pillarMaterial = resolveMaterial(cfg.getString("pillar-material", "POLISHED_ANDESITE"), Material.STONE);
    
  • Plain Text
       this.lightMaterial = resolveMaterial(cfg.getString("light-material", "SEA_LANTERN"), Material.GLOWSTONE);
    
  • Plain Text
       int maxHeight = world.getMaxHeight();
    
  • Plain Text
       int requestedHeight = cfg.getInt("height", 96);
    
  • Plain Text
       this.height = Math.min(maxHeight, Math.max(floorSpacing, requestedHeight));
    
  • Plain Text
       int playerX = requester.getLocation().getBlockX();
    
  • Plain Text
       int playerY = requester.getLocation().getBlockY();
    
  • Plain Text
       int playerZ = requester.getLocation().getBlockZ();
    
  • Plain Text
       this.originX = playerX - width / 2;
    
  • Plain Text
       this.originZ = playerZ - depth / 2;
    
  • Plain Text
       this.originY = Math.max(0, Math.min(playerY - 1, maxHeight - height));
    
  • Plain Text
       this.total = (long) width * depth * height;
    
  • }

  • public void start() {

  • Plain Text
       plugin.setActiveBuild(this);
    
  • Plain Text
       runTaskTimer(plugin, 1L, 1L);
    
  • Plain Text
       Location spawn = new Location(
    
  • world,

  • Plain Text
               originX + pillarSpacing / 2 + 0.5,
    
  • Plain Text
               originY + floorThickness,
    
  • Plain Text
               originZ + pillarSpacing / 2 + 0.5,
    
  • Plain Text
               requester.getLocation().getYaw(),
    
  • Plain Text
               requester.getLocation().getPitch());
    
  • Plain Text
       requester.teleport(spawn);
    

* End Patch

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code