Fix reporting of economy backend to bStats

This commit is contained in:
md678685 2020-07-06 21:13:35 +01:00
parent 1a6ad2fdb0
commit 6f149224d1
3 changed files with 17 additions and 4 deletions

View File

@ -65,8 +65,13 @@ public class MetricsWrapper {
metrics.addCustomChart(new Metrics.DrilldownPie("econPlugin", () -> { metrics.addCustomChart(new Metrics.DrilldownPie("econPlugin", () -> {
Map<String, Map<String, Integer>> result = new HashMap<>(); Map<String, Map<String, Integer>> result = new HashMap<>();
Map<String, Integer> backend = new HashMap<>(); Map<String, Integer> backend = new HashMap<>();
backend.put(Methods.getMethod().getPlugin().getName(), 1); if (Methods.hasMethod()) {
result.put(Methods.getMethod().getName(), backend); backend.put(Methods.getMethod().getBackend(), 1);
result.put(Methods.getMethod().getName(), backend);
} else {
backend.put("Essentials", 1);
result.put("Essentials", backend);
}
return result; return result;
})); }));
} }

View File

@ -33,6 +33,13 @@ public interface Method {
*/ */
String getName(); String getName();
/**
* Returns the backend plugin of this economy method, if applicable.
*
* @return <code>String</code> Plugin name.
*/
String getBackend();
/** /**
* Returns the reported name of this method. * Returns the reported name of this method.
* *

View File

@ -29,13 +29,14 @@ public class VaultEco implements Method {
return this.vault.getDescription().getName(); return this.vault.getDescription().getName();
} }
public String getEconomy() { @Override
public String getBackend() {
return economy == null ? "NoEco" : economy.getName(); return economy == null ? "NoEco" : economy.getName();
} }
@Override @Override
public String getLongName() { public String getLongName() {
return getName().concat(" - Economy: ").concat(getEconomy()); return getName().concat(" - Economy: ").concat(getBackend());
} }
@Override @Override