mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-05 01:59:46 +01:00
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;
|
||||
|
||||
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
|
||||
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user