Fixed sponge metrics

This commit is contained in:
Rsl1122 2018-08-16 12:21:55 +03:00
parent 23929d73ca
commit 5ad7f3f591
2 changed files with 12 additions and 4 deletions

View File

@ -14,6 +14,7 @@ import com.djrapitops.plugin.api.utility.log.DebugLog;
import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.settings.ColorScheme;
import com.google.inject.Inject;
import org.bstats.sponge.Metrics;
import org.slf4j.Logger;
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.event.Listener;
@ -27,6 +28,9 @@ import java.io.InputStream;
@Plugin(id = "plan", name = "Plan", version = "4.4.3", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"})
public class PlanSponge extends SpongePlugin implements PlanPlugin {
@Inject
private Metrics metrics;
@Inject
private Logger logger;
@ -58,7 +62,7 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin {
locale = system.getLocaleSystem().getLocale();
system.enable();
new BStatsSponge().registerMetrics();
new BStatsSponge(metrics).registerMetrics();
Log.info(locale.getString(PluginLang.ENABLED));
} catch (AbstractMethodError e) {

View File

@ -5,18 +5,22 @@ import com.djrapitops.plan.system.info.connection.ConnectionSystem;
import com.djrapitops.plugin.api.utility.log.Log;
import org.bstats.sponge.Metrics;
import javax.inject.Inject;
import java.io.Serializable;
public class BStatsSponge {
@Inject
private Metrics metrics;
private final Metrics metrics;
public BStatsSponge(Metrics metrics) {
this.metrics = metrics;
}
public void registerMetrics() {
Log.logDebug("Enable", "Enabling bStats Metrics.");
if (metrics != null) {
registerConfigSettingGraphs();
} else {
Log.debug("Metrics not injected properly.");
}
}