From f119fbb6f66fbbd2a1235cbc3206e823712f1f1d Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 9 Apr 2013 13:02:40 +0200 Subject: [PATCH] Remove old Essentials chat integration features. --- src/com/massivecraft/factions/Factions.java | 30 ----------- .../integration/EssentialsFeatures.java | 14 +---- .../EssentialsOldVersionFeatures.java | 53 ------------------- 3 files changed, 1 insertion(+), 96 deletions(-) delete mode 100644 src/com/massivecraft/factions/integration/EssentialsOldVersionFeatures.java diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java index f8416fe2..9cc7a26a 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/Factions.java @@ -9,7 +9,6 @@ import java.util.Set; import org.bukkit.block.Block; import org.bukkit.entity.Player; -import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.Location; import org.bukkit.Material; @@ -236,35 +235,6 @@ public class Factions extends MPlugin Conf.chatTagHandledByAnotherPlugin = notByFactions; } - // 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(AsyncPlayerChatEvent event) - { - if (event == null) return false; - return (isPlayerFactionChatting(event.getPlayer()) || isFactionsCommand(event.getMessage())); - } - - // Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels, - // local chat, or anything else which targets individual recipients, so Faction Chat can be done - /** - * @deprecated As of release 1.8, there is no built in faction chat. - */ - public boolean isPlayerFactionChatting(Player player) - { - return false; - } - - // Is this chat message actually a Factions command, and thus should be left alone by other plugins? - /** - * @deprecated As of release 1.8.1 the normal Bukkit command-handling is used. - */ - public boolean isFactionsCommand(String check) - { - return false; - } - // Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat public String getPlayerFactionTag(Player player) { diff --git a/src/com/massivecraft/factions/integration/EssentialsFeatures.java b/src/com/massivecraft/factions/integration/EssentialsFeatures.java index 39bbc25b..cc25fa30 100644 --- a/src/com/massivecraft/factions/integration/EssentialsFeatures.java +++ b/src/com/massivecraft/factions/integration/EssentialsFeatures.java @@ -59,27 +59,15 @@ public class EssentialsFeatures } catch (ClassNotFoundException ex) { - // no? try older Essentials 2.x integration method - try - { - EssentialsOldVersionFeatures.integrateChat(essChat); - } - catch (NoClassDefFoundError ex2) { /* no known integration method, then */ } + } } public static void unhookChat() { if (essChat == null) return; - - try - { - EssentialsOldVersionFeatures.unhookChat(); - } - catch (NoClassDefFoundError ex) {} } - // return false if feature is disabled or Essentials isn't available public static boolean handleTeleport(Player player, Location loc) { diff --git a/src/com/massivecraft/factions/integration/EssentialsOldVersionFeatures.java b/src/com/massivecraft/factions/integration/EssentialsOldVersionFeatures.java deleted file mode 100644 index 905c3488..00000000 --- a/src/com/massivecraft/factions/integration/EssentialsOldVersionFeatures.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.massivecraft.factions.integration; - -import org.bukkit.entity.Player; -import org.bukkit.event.player.AsyncPlayerChatEvent; - -import com.massivecraft.factions.Factions; -import com.massivecraft.factions.listeners.FactionsChatListener; - -import com.earth2me.essentials.chat.EssentialsChat; -import com.earth2me.essentials.chat.IEssentialsChatListener; - - -/* - * This Essentials integration handler is for older 2.x.x versions of Essentials which have "IEssentialsChatListener" - */ - -public class EssentialsOldVersionFeatures -{ - private static EssentialsChat essChat; - - public static void integrateChat(EssentialsChat instance) - { - essChat = instance; - try - { - essChat.addEssentialsChatListener("Factions", new IEssentialsChatListener() - { - public boolean shouldHandleThisChat(AsyncPlayerChatEvent event) - { - return Factions.p.shouldLetFactionsHandleThisChat(event); - } - public String modifyMessage(AsyncPlayerChatEvent event, Player target, String message) - { - return FactionsChatListener.parseTags(message, event.getPlayer(), target); - //return message.replace(Conf.chatTagReplaceString, P.p.getPlayerFactionTagRelation(event.getPlayer(), target)).replace("[FACTION_TITLE]", P.p.getPlayerTitle(event.getPlayer())); - } - }); - Factions.p.log("Found and will integrate chat with "+essChat.getDescription().getFullName()); - } - catch (NoSuchMethodError ex) - { - essChat = null; - } - } - - public static void unhookChat() - { - if (essChat != null) - { - essChat.removeEssentialsChatListener("Factions"); - } - } -}