Clean up integration methods with other plugins a bit
This commit is contained in:
@ -22,18 +22,8 @@ import net.milkbowl.vault.economy.Economy;
|
||||
public class Econ
|
||||
{
|
||||
private static Economy econ = null;
|
||||
|
||||
public static boolean shouldBeUsed()
|
||||
{
|
||||
return Conf.econEnabled && econ != null && econ.isEnabled();
|
||||
}
|
||||
|
||||
public static boolean isSetup()
|
||||
{
|
||||
return econ != null;
|
||||
}
|
||||
|
||||
public static void doSetup()
|
||||
public static void setup()
|
||||
{
|
||||
if (isSetup()) return;
|
||||
|
||||
@ -59,6 +49,18 @@ public class Econ
|
||||
P.p.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
||||
|
||||
P.p.cmdBase.cmdHelp.updateHelp();
|
||||
|
||||
oldMoneyDoTransfer();
|
||||
}
|
||||
|
||||
public static boolean shouldBeUsed()
|
||||
{
|
||||
return Conf.econEnabled && econ != null && econ.isEnabled();
|
||||
}
|
||||
|
||||
public static boolean isSetup()
|
||||
{
|
||||
return econ != null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
@ -15,12 +16,52 @@ import com.earth2me.essentials.chat.EssentialsLocalChatEvent;
|
||||
|
||||
/*
|
||||
* This Essentials integration handler is for newer 3.x.x versions of Essentials which don't have "IEssentialsChatListener"
|
||||
* If an older version is detected in the setup() method below, handling is passed off to EssentialsOldVersionFeatures
|
||||
*/
|
||||
|
||||
public class EssentialsFeatures
|
||||
{
|
||||
private static EssentialsChat essChat;
|
||||
|
||||
public static void setup()
|
||||
{
|
||||
if (essChat != null) return;
|
||||
|
||||
Plugin test = Bukkit.getServer().getPluginManager().getPlugin("EssentialsChat");
|
||||
if (test == null || !test.isEnabled()) return;
|
||||
|
||||
essChat = (EssentialsChat)test;
|
||||
|
||||
// try newer Essentials 3.x integration method
|
||||
try
|
||||
{
|
||||
Class.forName("com.earth2me.essentials.chat.EssentialsLocalChatEvent");
|
||||
integrateChat(essChat);
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
// no? try older Essentials 2.x integration method
|
||||
try
|
||||
{
|
||||
EssentialsOldVersionFeatures.integrateChat(essChat);
|
||||
}
|
||||
catch (NoClassDefFoundError ex2) { /* no known integration method, then */ }
|
||||
}
|
||||
}
|
||||
|
||||
public static void unhookChat()
|
||||
{
|
||||
if (essChat == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
EssentialsOldVersionFeatures.unhookChat();
|
||||
}
|
||||
catch (NoClassDefFoundError ex) {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void integrateChat(EssentialsChat instance)
|
||||
{
|
||||
essChat = instance;
|
||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -20,13 +21,14 @@ import com.massivecraft.factions.P;
|
||||
|
||||
public class LWCFeatures
|
||||
{
|
||||
|
||||
private static LWC lwc;
|
||||
|
||||
public static void integrateLWC(LWCPlugin test)
|
||||
|
||||
public static void setup()
|
||||
{
|
||||
lwc = test.getLWC();
|
||||
|
||||
Plugin test = Bukkit.getServer().getPluginManager().getPlugin("LWC");
|
||||
if(test == null || !test.isEnabled()) return;
|
||||
|
||||
lwc = ((LWCPlugin)test).getLWC();
|
||||
P.p.log("Successfully hooked into LWC!"+(Conf.lwcIntegration ? "" : " Integration is currently disabled, though (\"lwcIntegration\")."));
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import com.massivecraft.factions.P;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
@ -26,6 +27,14 @@ public class SpoutFeatures
|
||||
private transient static SpoutMainListener mainListener;
|
||||
private transient static boolean listenersHooked;
|
||||
|
||||
public static void setup()
|
||||
{
|
||||
Plugin test = Bukkit.getServer().getPluginManager().getPlugin("Spout");
|
||||
if (test == null || !test.isEnabled()) return;
|
||||
|
||||
setAvailable(true, test.getDescription().getFullName());
|
||||
}
|
||||
|
||||
// set integration availability
|
||||
public static void setAvailable(boolean enable, String pluginName)
|
||||
{
|
||||
|
Reference in New Issue
Block a user