Manually initialize metrics.

This commit is contained in:
Jeremy Wood 2023-03-25 16:49:04 -04:00
parent 372569ed6c
commit 472742dde8
No known key found for this signature in database
GPG Key ID: C5BAD04C77B91B4B
2 changed files with 6 additions and 3 deletions

View File

@ -30,6 +30,7 @@ import com.onarandombox.MultiverseCore.placeholders.MultiverseCorePlaceholders;
import com.onarandombox.MultiverseCore.utils.TestingMode;
import com.onarandombox.MultiverseCore.utils.metrics.MetricsConfigurator;
import com.onarandombox.MultiverseCore.world.WorldProperties;
import io.vavr.control.Try;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import me.main__.util.SerializationConfig.SerializationConfig;
@ -205,7 +206,9 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
private void setupMetrics() {
if (TestingMode.isDisabled()) {
// Load metrics
serviceLocator.getService(MetricsConfigurator.class);
serviceLocator.createAndInitialize(MetricsConfigurator.class);
} else {
Logging.info("Metrics are disabled in testing mode.");
}
}

View File

@ -8,13 +8,12 @@ import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import jakarta.annotation.PostConstruct;
import jakarta.inject.Inject;
import org.apache.commons.lang.WordUtils;
import org.bstats.bukkit.Metrics;
import org.bukkit.World;
import org.jvnet.hk2.annotations.Service;
@Service
public class MetricsConfigurator {
private static final int PLUGIN_ID = 7765;
@ -37,6 +36,7 @@ public class MetricsConfigurator {
return getWorldManager().getMVWorlds();
}
@PostConstruct
private void initMetrics() {
try {
addCustomGeneratorsMetric();