Preload some chat plugins before Factions to prevent conflicts
This commit is contained in:
		@@ -43,6 +43,7 @@ public class Conf {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	// Configuration on the Faction tag in chat messages.
 | 
						// Configuration on the Faction tag in chat messages.
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						public static boolean preloadChatPlugins = true;
 | 
				
			||||||
	public static boolean chatTagEnabled = true;
 | 
						public static boolean chatTagEnabled = true;
 | 
				
			||||||
	public static boolean chatTagRelationColored = true;
 | 
						public static boolean chatTagRelationColored = true;
 | 
				
			||||||
	public static int chatTagInsertIndex = 1;
 | 
						public static int chatTagInsertIndex = 1;
 | 
				
			||||||
@@ -66,11 +67,11 @@ public class Conf {
 | 
				
			|||||||
	public static boolean safeZoneDenyUseage = true;
 | 
						public static boolean safeZoneDenyUseage = true;
 | 
				
			||||||
	public static boolean safeZoneBlockTNT = true;
 | 
						public static boolean safeZoneBlockTNT = true;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						public static boolean warZoneDenyBuild = true;
 | 
				
			||||||
 | 
						public static boolean warZoneDenyUseage = true;
 | 
				
			||||||
	public static boolean warZoneBlockCreepers = false;
 | 
						public static boolean warZoneBlockCreepers = false;
 | 
				
			||||||
	public static boolean warZoneBlockFireballs = false;
 | 
						public static boolean warZoneBlockFireballs = false;
 | 
				
			||||||
	public static boolean warZoneBlockTNT = true;
 | 
						public static boolean warZoneBlockTNT = true;
 | 
				
			||||||
	public static boolean warZoneDenyBuild = true;
 | 
					 | 
				
			||||||
	public static boolean warZoneDenyUseage = true;
 | 
					 | 
				
			||||||
	public static boolean warZonePowerLoss = true;
 | 
						public static boolean warZonePowerLoss = true;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static Set<Material> territoryProtectedMaterials = new HashSet<Material>();
 | 
						public static Set<Material> territoryProtectedMaterials = new HashSet<Material>();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,6 +118,13 @@ public class Factions extends JavaPlugin {
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		setupPermissions();
 | 
							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
 | 
							// Register events
 | 
				
			||||||
		PluginManager pm = this.getServer().getPluginManager();
 | 
							PluginManager pm = this.getServer().getPluginManager();
 | 
				
			||||||
		pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Event.Priority.Highest, this);
 | 
							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
 | 
						// Test rights
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user