diff options
Diffstat (limited to 'EssentialsChat/src')
3 files changed, 9 insertions, 37 deletions
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java index 2bba47a2a..4807ada0f 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java @@ -39,8 +39,13 @@ public class EssentialsChat extends JavaPlugin chatListener.clear(); } - public void addEssentialsChatListener(String plugin, IEssentialsChatListener listener) + public void addEssentialsChatListener(final String plugin, final IEssentialsChatListener listener) { chatListener.put(plugin, listener); } + + public IEssentialsChatListener removeEssentialsChatListener(final String plugin) + { + return chatListener.remove(plugin); + } } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java index 634dc7157..b38073909 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java @@ -12,7 +12,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerListener; -//import org.mcteam.factions.Factions; public class EssentialsChatPlayerListener extends PlayerListener { @@ -20,7 +19,6 @@ public class EssentialsChatPlayerListener extends PlayerListener private final transient IEssentials ess; private final transient Server server; private final transient Map<String, IEssentialsChatListener> listeners; - //private static Factions factions = null; public EssentialsChatPlayerListener(final Server server, final IEssentials ess, final Map<String, IEssentialsChatListener> listeners) { @@ -37,8 +35,6 @@ public class EssentialsChatPlayerListener extends PlayerListener return; } - //if (factions != null && (factions.shouldLetFactionsHandleThisChat(event))) - // return; for (IEssentialsChatListener listener : listeners.values()) { if (listener.shouldHandleThisChat(event)) @@ -120,40 +116,10 @@ public class EssentialsChatPlayerListener extends PlayerListener for (IEssentialsChatListener listener : listeners.values()) { - message = listener.modifyMessage(event, message); - + message = listener.modifyMessage(event, p, message); } - //if (factions != null) - // message = message.replace("{FACTION}", factions.getPlayerFactionTagRelation(event.getPlayer(), p)).replace("{FACTION_TITLE}", factions.getPlayerTitle(event.getPlayer())); u.sendMessage(message); } } - - /*protected static void checkFactions(PluginManager pm) - { - if (factions != null) - return; - - Plugin factionsPlugin = pm.getPlugin("Factions"); - if (factionsPlugin == null) - return; - - factions = (Factions)factionsPlugin; - try - { // make sure Factions is sufficiently up-to-date - if (factions.hookSupportVersion() < 1) - factions = null; - } - catch (NoSuchMethodError ex) - { // if not, we can't work with it, so don't bother - factions = null; - } - - if (factions == null) - return; - - // normally a good thing, but we'll skip it to let Factions handle faction tags for global messages - //factions.handleFactionTagExternally(true); - }*/ } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/IEssentialsChatListener.java b/EssentialsChat/src/com/earth2me/essentials/chat/IEssentialsChatListener.java index e8467fea7..5c9c5c219 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/IEssentialsChatListener.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/IEssentialsChatListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.chat; +import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerChatEvent; @@ -7,5 +8,5 @@ public interface IEssentialsChatListener { boolean shouldHandleThisChat(PlayerChatEvent event); - String modifyMessage(PlayerChatEvent event, String message); + String modifyMessage(PlayerChatEvent event, Player target, String message); } |