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", () -> {
Map<String, Map<String, Integer>> result = new HashMap<>();
Map<String, Integer> backend = new HashMap<>();
backend.put(Methods.getMethod().getPlugin().getName(), 1);
result.put(Methods.getMethod().getName(), backend);
if (Methods.hasMethod()) {
backend.put(Methods.getMethod().getBackend(), 1);
result.put(Methods.getMethod().getName(), backend);
} else {
backend.put("Essentials", 1);
result.put("Essentials", backend);
}
return result;
}));
}

View File

@ -33,6 +33,13 @@ public interface Method {
*/
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.
*

View File

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