Move economy plugin setup process over to the Econ class
This commit is contained in:
parent
b45224fff0
commit
4e7aa893a3
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.massivecraft.factions.listeners.FactionsServerListener;
|
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);
|
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) {
|
public static void iConomySet(boolean enable) {
|
||||||
iConomyUse = enable;
|
iConomyUse = enable;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
@ -55,8 +55,8 @@ public class Factions extends JavaPlugin {
|
|||||||
private final FactionsEntityListener entityListener = new FactionsEntityListener();
|
private final FactionsEntityListener entityListener = new FactionsEntityListener();
|
||||||
private final FactionsBlockListener blockListener = new FactionsBlockListener();
|
private final FactionsBlockListener blockListener = new FactionsBlockListener();
|
||||||
|
|
||||||
public static PermissionHandler Permissions;
|
private static PermissionHandler Permissions;
|
||||||
public static EssentialsChat essChat;
|
private static EssentialsChat essChat;
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
public List<FBaseCommand> commands = new ArrayList<FBaseCommand>();
|
public List<FBaseCommand> commands = new ArrayList<FBaseCommand>();
|
||||||
@ -146,8 +146,7 @@ public class Factions extends JavaPlugin {
|
|||||||
|
|
||||||
setupPermissions();
|
setupPermissions();
|
||||||
integrateEssentialsChat();
|
integrateEssentialsChat();
|
||||||
setupEcon();
|
Econ.setup(this);
|
||||||
|
|
||||||
Econ.monitorPlugins();
|
Econ.monitorPlugins();
|
||||||
|
|
||||||
// Register events
|
// Register events
|
||||||
@ -213,25 +212,6 @@ public class Factions extends JavaPlugin {
|
|||||||
Factions.log("Permissions plugin not detected, defaulting to Bukkit superperms system");
|
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() {
|
private void integrateEssentialsChat() {
|
||||||
if (essChat != null) {
|
if (essChat != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user