From 4e7aa893a35488c347da352b05504adde0cf1f02 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Mon, 8 Aug 2011 04:51:06 -0500 Subject: [PATCH] Move economy plugin setup process over to the Econ class --- src/com/massivecraft/factions/Econ.java | 20 ++++++++++++++++ src/com/massivecraft/factions/Factions.java | 26 +++------------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/com/massivecraft/factions/Econ.java b/src/com/massivecraft/factions/Econ.java index de21d25f..aa992b33 100644 --- a/src/com/massivecraft/factions/Econ.java +++ b/src/com/massivecraft/factions/Econ.java @@ -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) { diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java index e31d331c..1f7e5f2d 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/Factions.java @@ -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 commands = new ArrayList(); @@ -146,8 +146,7 @@ public class Factions extends JavaPlugin { setupPermissions(); integrateEssentialsChat(); - setupEcon(); - + Econ.setup(this); Econ.monitorPlugins(); // Register events @@ -213,25 +212,6 @@ public class Factions extends JavaPlugin { Factions.log("Permissions plugin not detected, defaulting to Bukkit superperms system"); } } - - 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) {