package daibutz.minecraft.eventpusher;

import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;

public class EventPusher extends JavaPlugin {
	
	private Server server;
	private EventEncoder eventEncoder;
	
	@Override
	public void onEnable() {
		server = new Server(getConfig().getInt("port"), getConfig().getInt("max-clients"));
		server.startListening();
		
		eventEncoder = new EventEncoder(this);
		this.getServer().getPluginManager().registerEvents(eventEncoder, this);
	}
	
	@Override
	public void onDisable() {
		HandlerList.unregisterAll(eventEncoder);
		server.stopListening();
	}
	
	public void push(String jsonMessage) {
		if (getConfig().getBoolean("debug.print-to-console"))
			getLogger().info(jsonMessage);
		server.sendToAllClients(jsonMessage);
	}
}

@@ -33,16 +33,72 @@
 usher;%0A%0A
+import org.bukkit.configuration.file.FileConfiguration;%0A
 import o
@@ -215,17 +215,16 @@
 lugin %7B%0A
-%09
 %0A%09privat
@@ -280,46 +280,190 @@
 er;%0A
-%09%0A%09@Override%0A%09public void onEnable() %7B
+%0A%09public EventPusher() %7B%0A%09%09// Save the predefined and default config into the plugin folder if it is not there%0A%09%09saveDefaultConfig();%0A%0A%09%09FileConfiguration config = super.getConfig();
 %0A%09%09s
@@ -481,27 +481,22 @@
  Server(
-getC
+c
 onfig
-()
 .getInt(
@@ -505,22 +505,23 @@
 ort%22
-), getC
+, 7112), c
 onfig
-()
 .get
@@ -541,42 +541,15 @@
 nts%22
+, 1
 ));%0A
-%09%09server.startListening();%0A%09%09%0A
 %09%09ev
@@ -590,13 +590,82 @@
 );%0A%09
-%09this
+%7D%0A%0A%09@Override%0A%09public void onEnable() %7B%0A%09%09server.startListening();%0A%09%09super
 .get
@@ -731,17 +731,16 @@
 is);%0A%09%7D%0A
-%09
 %0A%09@Overr
@@ -842,17 +842,16 @@
 g();%0A%09%7D%0A
-%09
 %0A%09public

Make config file useable