Don't push vault version to metrics.

This commit is contained in:
KHobbits 2012-03-30 13:27:57 +01:00
parent f3345247ed
commit e795c6ed0b
10 changed files with 70 additions and 9 deletions

View file

@ -24,7 +24,7 @@ public class EssentialsPluginListener implements Listener, IConf
ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin()); ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin());
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager())) if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
{ {
ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")"); ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getLongName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
} }
} }

View file

@ -4,6 +4,7 @@ import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.metrics.Metrics.Graph; import com.earth2me.essentials.metrics.Metrics.Graph;
import com.earth2me.essentials.metrics.Metrics.Plotter; import com.earth2me.essentials.metrics.Metrics.Plotter;
import com.earth2me.essentials.register.payment.Method; import com.earth2me.essentials.register.payment.Method;
import com.earth2me.essentials.register.payment.methods.VaultEco;
import java.util.Locale; import java.util.Locale;
import java.util.logging.Level; import java.util.logging.Level;
@ -150,11 +151,18 @@ public class MetricsStarter implements Runnable
final Method method = ess.getPaymentMethod().getMethod(); final Method method = ess.getPaymentMethod().getMethod();
if (method != null) if (method != null)
{ {
String version = method.getVersion(); String version;
final int dashPosition = version.indexOf('-'); if (method instanceof VaultEco) {
if (dashPosition > 0)
{ version = ((VaultEco)method).getEconomy();
version = version.substring(0, dashPosition); }
else {
version = method.getVersion();
final int dashPosition = version.indexOf('-');
if (dashPosition > 0)
{
version = version.substring(0, dashPosition);
}
} }
depGraph.addPlotter(new SimplePlotter(method.getName() + " " + version)); depGraph.addPlotter(new SimplePlotter(method.getName() + " " + version));
} }

View file

@ -34,6 +34,13 @@ public interface Method
*/ */
public String getName(); public String getName();
/**
* Returns the reported name of this method.
*
* @return <code>String</code> Plugin name.
*/
public String getLongName();
/** /**
* Returns the actual version of this method. * Returns the actual version of this method.
* *

View file

@ -29,6 +29,12 @@ public class BOSE6 implements Method
return "BOSEconomy"; return "BOSEconomy";
} }
@Override
public String getLongName()
{
return getName();
}
@Override @Override
public String getVersion() public String getVersion()
{ {

View file

@ -29,6 +29,12 @@ public class BOSE7 implements Method
return "BOSEconomy"; return "BOSEconomy";
} }
@Override
public String getLongName()
{
return getName();
}
@Override @Override
public String getVersion() public String getVersion()
{ {

View file

@ -29,6 +29,12 @@ public class MCUR implements Method
return "MultiCurrency"; return "MultiCurrency";
} }
@Override
public String getLongName()
{
return getName();
}
@Override @Override
public String getVersion() public String getVersion()
{ {

View file

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

View file

@ -29,6 +29,12 @@ public class iCo4 implements Method
return "iConomy"; return "iConomy";
} }
@Override
public String getLongName()
{
return getName();
}
@Override @Override
public String getVersion() public String getVersion()
{ {

View file

@ -32,6 +32,12 @@ public class iCo5 implements Method
return "iConomy"; return "iConomy";
} }
@Override
public String getLongName()
{
return getName();
}
@Override @Override
public String getVersion() public String getVersion()
{ {

View file

@ -31,6 +31,12 @@ public class iCo6 implements Method
return "iConomy"; return "iConomy";
} }
@Override
public String getLongName()
{
return getName();
}
@Override @Override
public String getVersion() public String getVersion()
{ {