.mr.t.h_gamer

OptiCore - Minecraft Server Optimization Plugin PRD Overview

OptiCore is a premium all-in-one optimization plugin for Paper, Purpur, and Folia servers (1.20+ and 1.21+). It combines performance monitoring, adaptive optimization, smart ClearLag, analytics, reporting, PlaceholderAPI support, and INVENTORY GUI-based management.

Goals Maintain TPS above 19.0 whenever possible.

Reduce MSPT spikes.

Reduce lag from entities, chunks, hoppers, and redstone.

Provide actionable performance insights.

Minimize gameplay disruption.

Support Folia safely.

Provide INVENTORY GUI-first administration.

Main Comman Root Commands /opticore /opticore help

Opening /opticore should display the help menu or dashboard INVENTORY GUI.

Dashboard INVENTORY GUI

Command:

/opticore

INVENTORY GUI Size:

54 Slots

Features:

Live TPS MSPT Memory Usage CPU Usage Loaded Chunks Entity Count Active Modules ClearLag Status Optimization Status

Auto Refresh:

Every 2 seconds Monitoring System

Track:

TPS MSPT CPU Usage Memory Usage Loaded Chunks Active Chunks Entity Counts Hopper Activity Redstone Activity

Commands:

/opticore status /opticore health /opticore tps Smart Entity Management

Features:

Item Merging XP Orb Merging Entity Stacking Chunk Entity Limits Farm Detection Mob Control

Protected:

Named Mobs Villagers Pets Armor Stands NPCs Adaptive Lag Prevention

TPS Thresholds

Warning:

TPS < 19.5

Moderate:

TPS < 18.5

Critical:

TPS < 17.0

Emergency:

TPS < 15

Actions:

Merge entities Optimize chunks Run emergency cleanup Notify admins Chunk Optimization

Features:

Chunk Activity Tracking Inactive Chunk Unloading Async Chunk Operations Spawn Chunk Optimization

Commands:

/opticore chunks Redstone Optimization

Detect:

Redstone Clocks Hopper Chains Excessive Block Updates

Actions:

Warn Throttle Disable (Configurable) Memory Optimization

Features:

Heap Monitoring GC Statistics Leak Detection Warnings Memory Trend Analytics Smart ClearLag System

Commands:

/opticore clearlag /opticore clearlag now /opticore clearlag preview /opticore clearlag toggle

Features:

Scheduled Cleanup Emergency Cleanup Item Age Detection TPS-Based Cleanup

Protected:

Players Villagers Pets Named Mobs NPCs Armor Stands Item Frames Paintings

Warnings:

60s 30s 10s 5s

INVENTORY GUI:

Cleanup Status Next Cleanup Timer Run Cleanup Now Statistics Reports System

Commands:

/opticore report /opticore report INVENTORY GUI

Exports:

JSON CSV

Reports Include:

TPS History MSPT History Memory Usage CPU Usage Entity Statistics Chunk Statistics Cleanup Statistics Report INVENTORY GUI

Pages:

Dashboard Overview Entity Analytics Chunk Analytics Optimization History Recommendations

Features:

Auto Refresh Export Buttons Detailed Hover Information Module Management

Commands:

/opticore modules /opticore on /opticore off

INVENTORY GUI Controls:

Enable/Disable Entire Plugin Enable/Disable Individual Modules

Modules:

Entity Manager Chunk Optimizer Memory Monitor Lag Prevention Redstone Optimizer Reports PlaceholderAPI ClearLag

INVENTORY GUI Actions:

Left Click → Toggle Right Click → Details PlaceholderAPI Support

Server:

%opticore_tps% %opticore_mspt% %opticore_cpu_usage% %opticore_memory_used% %opticore_memory_percent%

Entities:

%opticore_entities_total% %opticore_entities_items% %opticore_entities_monsters%

Chunks:

%opticore_chunks_loaded% %opticore_chunks_active%

Optimization:

%opticore_status% %opticore_lag_level%

ClearLag:

%opticore_clearlag_enabled% %opticore_clearlag_next% %opticore_clearlag_removed_total%

Modules:

%opticore_enabled% %opticore_active_modules% %opticore_disabled_modules% Permissions opticore.help opticore.admin opticore.monitor opticore.cleanup opticore.reload opticore.report opticore.report.INVENTORY GUI opticore.report.export opticore.modules opticore.toggle opticore.clearlag opticore.clearlag.admin User File Structure

plugins/ └── OptiCore/ ├── config.yml ├── messages.yml ├── INVENTORY GUI.yml ├── modules.yml ├── reports/ ├── logs/ ├── data/ ├── backups/ └── cache/

Technical Requirements

Platform Support:

Paper Purpur Folia

Versions:

1.20+ 1.21+

Requirements:

Async processing Folia-safe schedulers Minimal CPU overhead Clean architecture Dependency injection Modular design Production-ready code Full comments and documentation Future Roadmap

Version 1.0.1

Discord Alerts Web Dashboard Prometheus Metrics REST API

Version 3.0

AI-Based Lag Prediction Auto Configuration Tuning Multi-Server Analytics Cluster Performance Monitoring

.mr.t.h_gamer

Plugin?

Kodari AI
KodariJun 13 at 6:35 pm 1

What should the plugin do? Give me a description and I’ll build it.

.mr.t.h_gamer

OptiCore - Minecraft Server Optimization Plugin PRD Overview

OptiCore is a premium all-in-one optimization plugin for Paper, Purpur, and Folia servers (1.20+ and 1.21+). It combines performance monitoring, adaptive optimization, smart ClearLag, analytics, reporting, PlaceholderAPI support, and INVENTORY GUI-based management.

Goals Maintain TPS above 19.0 whenever possible.

Reduce MSPT spikes.

Reduce lag from entities, chunks, hoppers, and redstone.

Provide actionable performance insights.

Minimize gameplay disruption.

Support Folia safely.

Provide INVENTORY GUI-first administration.

Main Comman Root Commands /opticore /opticore help

Opening /opticore should display the help menu or dashboard INVENTORY GUI.

Dashboard INVENTORY GUI

Command:

/opticore

INVENTORY GUI Size:

54 Slots

Features:

Live TPS MSPT Memory Usage CPU Usage Loaded Chunks Entity Count Active Modules ClearLag Status Optimization Status

Auto Refresh:

Every 2 seconds Monitoring System

Track:

TPS MSPT CPU Usage Memory Usage Loaded Chunks Active Chunks Entity Counts Hopper Activity Redstone Activity

Commands:

/opticore status /opticore health /opticore tps Smart Entity Management

Features:

Item Merging XP Orb Merging Entity Stacking Chunk Entity Limits Farm Detection Mob Control

Protected:

Named Mobs Villagers Pets Armor Stands NPCs Adaptive Lag Prevention

TPS Thresholds

Warning:

TPS < 19.5

Moderate:

TPS < 18.5

Critical:

TPS < 17.0

Emergency:

TPS < 15

Actions:

Merge entities Optimize chunks Run emergency cleanup Notify admins Chunk Optimization

Features:

Chunk Activity Tracking Inactive Chunk Unloading Async Chunk Operations Spawn Chunk Optimization

Commands:

/opticore chunks Redstone Optimization

Detect:

Redstone Clocks Hopper Chains Excessive Block Updates

Actions:

Warn Throttle Disable (Configurable) Memory Optimization

Features:

Heap Monitoring GC Statistics Leak Detection Warnings Memory Trend Analytics Smart ClearLag System

Commands:

/opticore clearlag /opticore clearlag now /opticore clearlag preview /opticore clearlag toggle

Features:

Scheduled Cleanup Emergency Cleanup Item Age Detection TPS-Based Cleanup

Protected:

Players Villagers Pets Named Mobs NPCs Armor Stands Item Frames Paintings

Warnings:

60s 30s 10s 5s

INVENTORY GUI:

Cleanup Status Next Cleanup Timer Run Cleanup Now Statistics Reports System

Commands:

/opticore report /opticore report INVENTORY GUI

Exports:

JSON CSV

Reports Include:

TPS History MSPT History Memory Usage CPU Usage Entity Statistics Chunk Statistics Cleanup Statistics Report INVENTORY GUI

Pages:

Dashboard Overview Entity Analytics Chunk Analytics Optimization History Recommendations

Features:

Auto Refresh Export Buttons Detailed Hover Information Module Management

Commands:

/opticore modules /opticore on /opticore off

INVENTORY GUI Controls:

Enable/Disable Entire Plugin Enable/Disable Individual Modules

Modules:

Entity Manager Chunk Optimizer Memory Monitor Lag Prevention Redstone Optimizer Reports PlaceholderAPI ClearLag

INVENTORY GUI Actions:

Left Click → Toggle Right Click → Details PlaceholderAPI Support

Server:

%opticore_tps% %opticore_mspt% %opticore_cpu_usage% %opticore_memory_used% %opticore_memory_percent%

Entities:

%opticore_entities_total% %opticore_entities_items% %opticore_entities_monsters%

Chunks:

%opticore_chunks_loaded% %opticore_chunks_active%

Optimization:

%opticore_status% %opticore_lag_level%

ClearLag:

%opticore_clearlag_enabled% %opticore_clearlag_next% %opticore_clearlag_removed_total%

Modules:

%opticore_enabled% %opticore_active_modules% %opticore_disabled_modules% Permissions opticore.help opticore.admin opticore.monitor opticore.cleanup opticore.reload opticore.report opticore.report.INVENTORY GUI opticore.report.export opticore.modules opticore.toggle opticore.clearlag opticore.clearlag.admin User File Structure

plugins/ └── OptiCore/ ├── config.yml ├── messages.yml ├── INVENTORY GUI.yml ├── modules.yml ├── reports/ ├── logs/ ├── data/ ├── backups/ └── cache/

Technical Requirements

Platform Support:

Paper Purpur Folia

Versions:

1.20+ 1.21+

Requirements:

Async processing Folia-safe schedulers Minimal CPU overhead Clean architecture Dependency injection Modular design Production-ready code Full comments and documentation Future Roadmap

Version 2.0

Discord Alerts Web Dashboard Prometheus Metrics REST API

Version 3.0

AI-Based Lag Prediction Auto Configuration Tuning Multi-Server Analytics Cluster Performance Monitoring

Kodari AI
KodariJun 13 at 7:00 pm 149
OptiCore
OptiCore is a premium all-in-one Minecraft server optimization plugin for Paper, Purpur, and Folia (1.20+). Features include real-time performance monitoring (TPS, MSPT, CPU, memory), smart entity management with item/XP merging, adaptive lag prevention, chunk optimization, redstone clock detection, intelligent ClearLag with countdowns, JSON/CSV analytics reports, full PlaceholderAPI support, and an inventory GUI dashboard with auto-refresh and module management.

Plan:

  1. Build infrastructure — build.gradle, plugin.yml, config/messages/modules/gui YMLs

  2. Core utilities — CancellableTask, FoliaUtil, ColorUtil, ItemBuilder

  3. Data classes — PerformanceSnapshot, ClearLagStats

  4. Module system — OptiCoreModule abstract, LagLevel enum

  5. All 8 modules — Monitoring, Entity, Chunk, Memory, LagPrevention, Redstone, ClearLag, Reports

  6. Inventory GUI framework — Handler, Button, GUI, GUIManager, GUIListener

  7. GUI implementations — Dashboard, ClearLag, Modules, Report

  8. Command router — OptiCoreCommand

  9. PlaceholderAPI expansion — OptiCorePlaceholders

  10. Main plugin — OptiCore (wires everything)


Now I need to fix a compilation issue in RedstoneOptimizer — there’s an accidental duplicate Bukkit class at the bottom. Let me also fix a missing import org.bukkit.Bukkit in that file:

Now, let me write all the actual file content. Since the <create> tags above executed as empty file placeholders, I need to write the actual content with <update>:


OptiCore is complete. Here’s a summary of what was built:

Architecture (36 files)

Layer
Classes
Core
OptiCore
,
ConfigManager
,
ModuleManager
,
FoliaUtil
,
CancellableTask
Modules (8)
MonitoringModule
,
EntityManager
,
ChunkOptimizer
,
MemoryMonitor
,
LagPrevention
,
RedstoneOptimizer
,
ClearLagModule
,
ReportsModule
GUI Framework
InventoryHandler
,
InventoryButton
,
InventoryGUI
,
GUIManager
,
GUIListener
GUI Screens
DashboardGUI
(54-slot, 2s auto-refresh),
ClearLagGUI
,
ModulesGUI
,
ReportGUI
(5 pages)
Commands
OptiCoreCommand
(full tab-completion)
PlaceholderAPI
OptiCorePlaceholders
(21 placeholders)
Utilities
ColorUtil
(MiniMessage),
ItemBuilder
(fluent +
<!italic>
)
Data
PerformanceSnapshot
(Lombok
@Data
),
ClearLagStats

Key highlights

  • Folia-safe — all scheduling goes through FoliaUtil which uses reflection to access GlobalRegionScheduler/AsyncScheduler when Folia is detected, falling back to BukkitScheduler on Paper/Purpur

  • Adaptive lag prevention — polls TPS every 5s and escalates: WARN → merge entities → optimize chunks → emergency ClearLag, with a configurable cooldown

  • Smart ClearLag — countdown timer with broadcasts at 60/30/10/5s, item-age filtering, emergency mode removes all items

  • MiniMessage throughout — all text uses Adventure/MiniMessage with <!italic> prefix on all item display names

  • XMaterial everywhere — all material lookups are cross-version safe

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
36 4,085
src/main/java/com/opticore/OptiCore.java
package com.opticore;

import com.opticore.command.OptiCoreCommand;
import com.opticore.inventory.gui.GUIListener;
import com.opticore.inventory.gui.GUIManager;
import com.opticore.inventory.impl.DashboardGUI;
import com.opticore.module.*;
import com.opticore.placeholder.OptiCorePlaceholders;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;

/**
 * Main plugin class for OptiCore.
 *
 * <p>Initialisation order:</p>
 * <ol>
 *   <li>Create data folder sub-directories</li>
 *   <li>Load {@link ConfigManager}</li>
 *   <li>Create {@link GUIManager} and register {@link GUIListener}</li>
 *   <li>Create {@link ModuleManager} and register all modules</li>
 *   <li>Enable modules based on modules.yml</li>
 *   <li>Register command handler</li>
 *   <li>Register PlaceholderAPI expansion if present</li>
 * </ol>
 */
public class OptiCore extends JavaPlugin {

    private static OptiCore instance;

    private ConfigManager configManager;
    private ModuleManager moduleManager;
    private GUIManager guiManager;

    @Override
    public void onEnable() {
        instance = this;

        // Ensure all required sub-directories exist
        createDataDirectories();

        // Load configuration files
        configManager = new ConfigManager(this);
        configManager.load();

        // GUI system
        guiManager = new GUIManager();
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);

        // Register and enable modules
        moduleManager = new ModuleManager(this);
        registerModules();
        moduleManager.enableAll();

        // Command
        OptiCoreCommand commandHandler = new OptiCoreCommand(this);
        PluginCommand command = getCommand("opticore");
        if (command != null) {
            command.setExecutor(commandHandler);
            command.setTabCompleter(commandHandler);
        }

        // PlaceholderAPI integration
        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            boolean papiModuleEnabled = configManager.getModulesConfig().getBoolean("placeholderapi.enabled", true);
            if (papiModuleEnabled) {
                new OptiCorePlaceholders(this).register();
                getLogger().info("[OptiCore] PlaceholderAPI expansion registered.");
            }
        }

        String folia = FoliaUtil.isFolia() ? " (Folia mode)" : "";
        getLogger().info("[OptiCore] Enabled successfully — " + moduleManager.getAllModules().stream()
                .filter(com.opticore.module.OptiCoreModule::isEnabled).count()
                + " modules active." + folia);
    }

    @Override
    public void onDisable() {
        // Close all open GUIs to prevent NPEs during shutdown
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (guiManager.isTracked(player.getOpenInventory().getTopInventory())) {
                player.closeInventory();
            }
        }

        moduleManager.disableAll();
        getLogger().info("[OptiCore] Disabled. Goodbye!");
    }

    // ---- Module registration ----

    private void registerModules() {
        // Monitoring must be first — other modules depend on its data
        moduleManager.register(new MonitoringModule(this));
        moduleManager.register(new EntityManager(this));
        moduleManager.register(new ChunkOptimizer(this));
        moduleManager.register(new MemoryMonitor(this));
        moduleManager.register(new LagPrevention(this));
        moduleManager.register(new RedstoneOptimizer(this));
        moduleManager.register(new ClearLagModule(this));
        moduleManager.register(new ReportsModule(this));
    }

    // ---- Directory setup ----

    private void createDataDirectories() {
        String[] dirs = {"reports", "logs", "data", "backups", "cache"};
        for (String dir : dirs) {
            File d = new File(getDataFolder(), dir);
            if (!d.exists()) d.mkdirs();
        }
    }

    // ---- Static accessor ----

    /** Returns the OptiCore plugin instance. */
    public static OptiCore getInstance() { return instance; }

    // ---- Accessors ----

    /** Returns the configuration manager. */
    public ConfigManager getConfigManager() { return configManager; }

    /** Returns the module manager. */
    public ModuleManager getModuleManager() { return moduleManager; }

    /** Returns the GUI manager. */
    public GUIManager getGUIManager() { return guiManager; }
}