Fix metrics when kits are improperly configured.

This commit is contained in:
KHobbits 2012-08-31 14:09:20 +01:00
parent ce90e9710e
commit 2ac4c8e665

View file

@ -7,6 +7,7 @@ import com.earth2me.essentials.register.payment.Method;
import com.earth2me.essentials.register.payment.methods.VaultEco; 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;
import org.bukkit.configuration.ConfigurationSection;
public class MetricsStarter implements Runnable public class MetricsStarter implements Runnable
@ -100,7 +101,9 @@ public class MetricsStarter implements Runnable
@Override @Override
public int getValue() public int getValue()
{ {
return ess.getSettings().getKits().getKeys(false).size(); ConfigurationSection kits = ess.getSettings().getKits();
if (kits == null) { return 0; }
return kits.getKeys(false).size();
} }
}); });
featureGraph.addPlotter(new Plotter("Warps") featureGraph.addPlotter(new Plotter("Warps")
@ -123,7 +126,7 @@ public class MetricsStarter implements Runnable
{ {
enabledGraph.addPlotter(new SimplePlotter("Jails")); enabledGraph.addPlotter(new SimplePlotter("Jails"));
} }
if (ess.getSettings().getKits().getKeys(false).size() > 0) if (ess.getSettings().getKits() != null && ess.getSettings().getKits().getKeys(false).size() > 0)
{ {
enabledGraph.addPlotter(new SimplePlotter("Kits")); enabledGraph.addPlotter(new SimplePlotter("Kits"));
} }