-
Notifications
You must be signed in to change notification settings - Fork 0
Developer API
shvquu edited this page Jun 13, 2026
·
4 revisions
ServerDoctor exposes a stable public API in the serverdoctor-api module so other plugins can read diagnostics, subscribe to events, and register custom scanners.
Use compileOnly — the installed ServerDoctor plugin provides the implementation at runtime. Do not shade the API into your plugin.
repositories { maven("https://jitpack.io") }
dependencies {
compileOnly("com.github.YOUR-NAME.serverdoctor:serverdoctor-api:v0.5.0")
}Declare the dependency in your plugin.yml so ServerDoctor loads first:
depend: [ServerDoctor]import com.serverdoctor.api.ServerDoctorApi;
import com.serverdoctor.api.ServerDoctorProvider;
if (ServerDoctorProvider.isAvailable()) {
ServerDoctorApi api = ServerDoctorProvider.get();
// use api...
}ServerDoctorProvider.get() throws IllegalStateException if ServerDoctor isn't initialized yet — guard with isAvailable() or rely on the depend ordering.
| Method | Returns |
|---|---|
getPerformanceSnapshot() |
A fresh PerformanceSnapshot (TPS, MSPT, memory, threads, players) |
getLatestReport() |
Optional<DiagnosticReport> from the last run |
getConflicts() |
List<ConflictReport> from the last run |
getSecurityRisks() |
List<SecurityRisk> from the last run |
getRecommendations() |
List<Recommendation> from the last run |
runDiagnostics() |
Runs a full analysis now and returns the DiagnosticReport
|
registerModule(AnalysisModule) |
Adds a custom scanner (see Custom Scanners) |
unregisterModule(String id) |
Removes a scanner by id |
events() |
The EventBus (see Events) |
ServerDoctorApi api = ServerDoctorProvider.get();
PerformanceSnapshot perf = api.getPerformanceSnapshot();
double tps = perf.tps1m();
long usedMb = perf.memory().usedMb();
for (ConflictReport c : api.getConflicts()) {
getLogger().warning(c.pluginA() + " + " + c.pluginB() + ": " + c.description());
}-
PerformanceSnapshot—tps1m(),mspt(),memory()(MemoryStats:usedMb(),maxMb(),usedRatio()),threadCount(),onlinePlayers(),capturedAt(). -
PluginInfo—name(),version(),authors(),hardDepends(),softDepends(),enabled(). -
ConflictReport—pluginA(),pluginB(),severity(),description(). -
SecurityRisk—pluginName(),type(),severity(),description(). -
Recommendation—category(),severity(),title(),description(). -
DiagnosticReport—performance(),results(),recommendations(),conflicts(),securityRisks(),overallSeverity(),timestamp(). -
Severity—OK, INFO, LOW, MEDIUM, HIGH, CRITICAL(withatLeast(...)).
ServerDoctor · read-only analysis for Minecraft servers & proxies · MIT · Repository