From cddaa7394814dc3e194b60dac8fa2f6a5f8a73ca Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sat, 11 Jun 2011 19:02:57 -0500 Subject: [PATCH] Added another hook, handleFactionTagExternally, for chat plugins to indicate they're handling faction tag insertion into chat --- src/org/mcteam/factions/Conf.java | 1 + src/org/mcteam/factions/Factions.java | 5 +++++ .../mcteam/factions/listeners/FactionsPlayerListener.java | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/org/mcteam/factions/Conf.java b/src/org/mcteam/factions/Conf.java index aba92d45..708e5bc6 100644 --- a/src/org/mcteam/factions/Conf.java +++ b/src/org/mcteam/factions/Conf.java @@ -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 = ""; diff --git a/src/org/mcteam/factions/Factions.java b/src/org/mcteam/factions/Factions.java index 741470b7..014e2295 100644 --- a/src/org/mcteam/factions/Factions.java +++ b/src/org/mcteam/factions/Factions.java @@ -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); diff --git a/src/org/mcteam/factions/listeners/FactionsPlayerListener.java b/src/org/mcteam/factions/listeners/FactionsPlayerListener.java index 073d8f35..681bd19c 100644 --- a/src/org/mcteam/factions/listeners/FactionsPlayerListener.java +++ b/src/org/mcteam/factions/listeners/FactionsPlayerListener.java @@ -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; }