Added another hook, handleFactionTagExternally, for chat plugins to indicate they're handling faction tag insertion into chat

This commit is contained in:
Brettflan 2011-06-11 19:02:57 -05:00
parent 619544ed6d
commit cddaa73948
3 changed files with 7 additions and 1 deletions

View File

@ -45,6 +45,7 @@ public class Conf {
// Configuration on the Faction tag in chat messages.
public static boolean preloadChatPlugins = true;
public static boolean chatTagEnabled = true;
public static transient boolean chatTagHandledByAnotherPlugin = false;
public static boolean chatTagRelationColored = true;
public static String chatTagReplaceString = "{FACTION}";
public static String chatTagInsertAfterString = "";

View File

@ -209,6 +209,11 @@ public class Factions extends JavaPlugin {
return me.isFactionChatting();
}
// If another plugin is handling insertion of chat tags, this should be used to notify Factions
public static void handleFactionTagExternally(boolean notByFactions) {
Conf.chatTagHandledByAnotherPlugin = notByFactions;
}
// Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat
public static String getPlayerFactionTag(Player player) {
return getPlayerFactionTagRelation(player, null);

View File

@ -64,7 +64,7 @@ public class FactionsPlayerListener extends PlayerListener{
// Are we to insert the Faction tag into the format?
// If we are not to insert it - we are done.
if ( ! Conf.chatTagEnabled) {
if ( ! Conf.chatTagEnabled || Conf.chatTagHandledByAnotherPlugin) {
return;
}