From c80f6d803c0a75d6f3ca50ce822e692f4b8816ef Mon Sep 17 00:00:00 2001 From: Brettflan Date: Tue, 28 Jun 2011 18:25:00 -0500 Subject: [PATCH] one more hookable utility function for other plugins to use, to determine the support version for the hook functions (will increment whenever new hooks are added) --- src/org/mcteam/factions/Factions.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/org/mcteam/factions/Factions.java b/src/org/mcteam/factions/Factions.java index 590cd57a..2925b779 100644 --- a/src/org/mcteam/factions/Factions.java +++ b/src/org/mcteam/factions/Factions.java @@ -183,6 +183,11 @@ public class Factions extends JavaPlugin { // Functions for other plugins to hook into // -------------------------------------------- // + // This value will be updated whenever new hooks are added + public int hookSupportVersion() { + return 1; + } + // If another plugin is handling insertion of chat tags, this should be used to notify Factions public void handleFactionTagExternally(boolean notByFactions) { Conf.chatTagHandledByAnotherPlugin = notByFactions; @@ -191,6 +196,8 @@ public class Factions extends JavaPlugin { // Simply put, should this chat event be left for Factions to handle? For now, that means players with Faction Chat // enabled or use of the Factions f command without a slash; combination of isPlayerFactionChatting() and isFactionsCommand() public boolean ShouldLetFactionsHandleThisChat(PlayerChatEvent event) { + if (event == null) + return false; return (isPlayerFactionChatting(event.getPlayer()) || isFactionsCommand(event.getMessage())); } @@ -207,6 +214,8 @@ public class Factions extends JavaPlugin { // Is this chat message actually a Factions command, and thus should be left alone by other plugins? public boolean isFactionsCommand(String check) { + if (check == null) + return false; return ((check.startsWith(instance.getBaseCommand()+" ") || check.equals(instance.getBaseCommand())) && Conf.allowNoSlashCommand); }