Move economy plugin setup process over to the Econ class
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
package com.massivecraft.factions;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.event.Event;
 | 
			
		||||
import org.bukkit.plugin.Plugin;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.factions.listeners.FactionsServerListener;
 | 
			
		||||
 | 
			
		||||
@@ -18,6 +19,25 @@ public class Econ {
 | 
			
		||||
		Factions.instance.getServer().getPluginManager().registerEvent(Event.Type.PLUGIN_DISABLE, new FactionsServerListener(), Event.Priority.Monitor, Factions.instance);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void setup(Factions factions) {
 | 
			
		||||
		if (enabled()) {
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
        if (!iConomyHooked()) {
 | 
			
		||||
			Plugin plug = factions.getServer().getPluginManager().getPlugin("iConomy");
 | 
			
		||||
			if (plug != null && plug.getClass().getName().equals("com.iConomy.iConomy") && plug.isEnabled()) {
 | 
			
		||||
				iConomySet(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (!essentialsEcoHooked()) {
 | 
			
		||||
			Plugin plug = factions.getServer().getPluginManager().getPlugin("Essentials");
 | 
			
		||||
			if (plug != null && plug.isEnabled()) {
 | 
			
		||||
				essentialsEcoSet(true);
 | 
			
		||||
			}
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void iConomySet(boolean enable) {
 | 
			
		||||
		iConomyUse = enable;
 | 
			
		||||
		if (enable) {
 | 
			
		||||
 
 | 
			
		||||
@@ -55,8 +55,8 @@ public class Factions extends JavaPlugin {
 | 
			
		||||
	private final FactionsEntityListener entityListener = new FactionsEntityListener();
 | 
			
		||||
	private final FactionsBlockListener blockListener = new FactionsBlockListener();
 | 
			
		||||
	
 | 
			
		||||
	public static PermissionHandler Permissions;
 | 
			
		||||
	public static EssentialsChat essChat;
 | 
			
		||||
	private static PermissionHandler Permissions;
 | 
			
		||||
	private static EssentialsChat essChat;
 | 
			
		||||
 | 
			
		||||
	// Commands
 | 
			
		||||
	public List<FBaseCommand> commands = new ArrayList<FBaseCommand>();
 | 
			
		||||
@@ -146,8 +146,7 @@ public class Factions extends JavaPlugin {
 | 
			
		||||
		
 | 
			
		||||
		setupPermissions();
 | 
			
		||||
		integrateEssentialsChat();
 | 
			
		||||
		setupEcon();
 | 
			
		||||
		
 | 
			
		||||
		Econ.setup(this);
 | 
			
		||||
		Econ.monitorPlugins();
 | 
			
		||||
		
 | 
			
		||||
		// Register events
 | 
			
		||||
@@ -214,25 +213,6 @@ public class Factions extends JavaPlugin {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void setupEcon() {
 | 
			
		||||
		if (Econ.enabled()) {
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
        if (!Econ.iConomyHooked()) {
 | 
			
		||||
			Plugin plug = this.getServer().getPluginManager().getPlugin("iConomy");
 | 
			
		||||
			if (plug != null && plug.getClass().getName().equals("com.iConomy.iConomy")) {
 | 
			
		||||
				Econ.iConomySet(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (!Econ.essentialsEcoHooked()) {
 | 
			
		||||
			Plugin plug = this.getServer().getPluginManager().getPlugin("Essentials");
 | 
			
		||||
			if (plug != null) {
 | 
			
		||||
				Econ.essentialsEcoSet(true);
 | 
			
		||||
			}
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void integrateEssentialsChat() {
 | 
			
		||||
		if (essChat != null) {
 | 
			
		||||
			return;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user