diff --git a/src/main/java/ru/ruscalworld/fabricexporter/FabricExporter.java b/src/main/java/ru/ruscalworld/fabricexporter/FabricExporter.java index 61b1a4f..09ac4ee 100644 --- a/src/main/java/ru/ruscalworld/fabricexporter/FabricExporter.java +++ b/src/main/java/ru/ruscalworld/fabricexporter/FabricExporter.java @@ -30,12 +30,15 @@ public class FabricExporter implements ModInitializer { MetricUpdater metricUpdater = new MetricUpdater(this); metricUpdater.registerMetric(new OnlinePlayers()); - metricUpdater.registerMetric(new TicksPerSecond()); - metricUpdater.registerMetric(new MillisPerTick()); metricUpdater.registerMetric(new Entities()); metricUpdater.registerMetric(new LoadedChunks()); metricUpdater.registerMetric(new TotalLoadedChunks()); + if (this.getConfig().shouldUseSpark()) { + metricUpdater.registerMetric(new TicksPerSecond()); + metricUpdater.registerMetric(new MillisPerTick()); + } + Timer timer = new Timer(); ServerLifecycleEvents.SERVER_STARTING.register(this::setServer); diff --git a/src/main/java/ru/ruscalworld/fabricexporter/config/MainConfig.java b/src/main/java/ru/ruscalworld/fabricexporter/config/MainConfig.java index f49a967..8f54a33 100644 --- a/src/main/java/ru/ruscalworld/fabricexporter/config/MainConfig.java +++ b/src/main/java/ru/ruscalworld/fabricexporter/config/MainConfig.java @@ -7,6 +7,7 @@ import java.util.Properties; public class MainConfig extends Config { private int port; private int updateInterval; + private boolean useSpark; public MainConfig(String name) { super(name); @@ -19,6 +20,8 @@ public class MainConfig extends Config { String updateIntervalString = properties.getProperty("update-interval", "1000"); this.setUpdateInterval(ConvertUtil.intToStringOrDefault(updateIntervalString, 1000)); + + this.setShouldUseSpark(properties.getProperty("use-spark", "true").equalsIgnoreCase("true")); } public int getPort() { @@ -36,4 +39,12 @@ public class MainConfig extends Config { public void setUpdateInterval(int updateInterval) { this.updateInterval = updateInterval; } + + public boolean shouldUseSpark() { + return useSpark; + } + + public void setShouldUseSpark(boolean useSpark) { + this.useSpark = useSpark; + } } diff --git a/src/main/resources/config/exporter.properties b/src/main/resources/config/exporter.properties index ca6ab71..22aaa35 100644 --- a/src/main/resources/config/exporter.properties +++ b/src/main/resources/config/exporter.properties @@ -1,2 +1,3 @@ server-port=25585 -update-interval=1000 \ No newline at end of file +update-interval=1000 +use-spark=true \ No newline at end of file