Preload some chat plugins before Factions to prevent conflicts

This commit is contained in:
Brettflan 2011-06-01 06:39:25 -05:00
parent f9cffebe27
commit 29469b0d27
2 changed files with 20 additions and 2 deletions

View File

@ -43,6 +43,7 @@ public class Conf {
// Configuration on the Faction tag in chat messages.
public static boolean preloadChatPlugins = true;
public static boolean chatTagEnabled = true;
public static boolean chatTagRelationColored = true;
public static int chatTagInsertIndex = 1;
@ -66,11 +67,11 @@ public class Conf {
public static boolean safeZoneDenyUseage = true;
public static boolean safeZoneBlockTNT = true;
public static boolean warZoneDenyBuild = true;
public static boolean warZoneDenyUseage = true;
public static boolean warZoneBlockCreepers = false;
public static boolean warZoneBlockFireballs = false;
public static boolean warZoneBlockTNT = true;
public static boolean warZoneDenyBuild = true;
public static boolean warZoneDenyUseage = true;
public static boolean warZonePowerLoss = true;
public static Set<Material> territoryProtectedMaterials = new HashSet<Material>();

View File

@ -118,6 +118,13 @@ public class Factions extends JavaPlugin {
setupPermissions();
// preload some chat plugins if they're on the server to prevent potential conflicts
if (Conf.preloadChatPlugins) {
preloadPlugin("EssentialsChat");
preloadPlugin("HeroChat");
preloadPlugin("iChat");
}
// Register events
PluginManager pm = this.getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Event.Priority.Highest, this);
@ -176,6 +183,16 @@ public class Factions extends JavaPlugin {
}
}
private void preloadPlugin(String pluginName) {
PluginManager pm = this.getServer().getPluginManager();
Plugin prePlug = pm.getPlugin(pluginName);
if (prePlug != null && !pm.isPluginEnabled(prePlug)) {
Factions.log("Preloading \"" + pluginName + "\" plugin to prevent conflicts.");
pm.enablePlugin(prePlug);
}
}
// -------------------------------------------- //
// Test rights
// -------------------------------------------- //