Permalink
Browse files

Fix for metrics Exception. and minor cleanup.

  • Loading branch information...
angelofdev committed Jun 23, 2012
1 parent 7c29521 commit c5b4b8877d5f4e8657aed83437f8b0e4e4481d64
Showing with 19 additions and 11 deletions.
  1. +19 −11 src/me/angelofdev/NoOby/NoOby.java
@@ -20,15 +20,21 @@
package me.angelofdev.NoOby;
+import java.io.IOException;
+
+import me.angelofdev.NoOby.config.Configuration;
+
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class NoOby extends JavaPlugin {
- private final NoObyBlockListener playerListener = new NoObyBlockListener (this);
+ private NoObyBlockListener blockListener;
private static String version;
private static final String PLUGIN_NAME = "NoOby";
+ public static NoOby instance;
+
@Override
public void onDisable() {
Log.info(PLUGIN_NAME + " disabled");
@@ -39,15 +45,16 @@ public void onEnable() {
PluginDescriptionFile pdfFile = getDescription();
version = pdfFile.getVersion();
+ initialise();
initMetrics();
Log.info("Loading configs...");
Configuration.start();
Log.info("loaded configs!");
Log.info(PLUGIN_NAME + " v" + version + " enabled");
-
PluginManager pm = getServer().getPluginManager();
- pm.registerEvents(this.playerListener, this);
+
+ pm.registerEvents(this.blockListener, this);
}
public static String getPluginName() {
@@ -58,18 +65,19 @@ public static String getPluginName() {
public String toString() {
return getPluginName();
}
+
+ private void initialise() {
+ blockListener = new NoObyBlockListener();
+ instance = this;
+
+ }
private void initMetrics() {
try {
- MetricsLite metrics = new MetricsLite(instance);
+ MetricsLite metrics = new MetricsLite(this);
metrics.start();
} catch (IOException e) {
// Failed to submit the stats :-(
}
- }
-
- public NoObyBlockListener getListener() {
- return playerListener;
- }
-
-}
+ }
+}

0 comments on commit c5b4b88

Please sign in to comment.