mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 06:57:39 +01:00
More changes to the EssentialsChat API for Factions
This commit is contained in:
parent
3b59dd0b02
commit
0483635a5c
@ -39,8 +39,13 @@ public class EssentialsChat extends JavaPlugin
|
|||||||
chatListener.clear();
|
chatListener.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEssentialsChatListener(String plugin, IEssentialsChatListener listener)
|
public void addEssentialsChatListener(final String plugin, final IEssentialsChatListener listener)
|
||||||
{
|
{
|
||||||
chatListener.put(plugin, listener);
|
chatListener.put(plugin, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEssentialsChatListener removeEssentialsChatListener(final String plugin)
|
||||||
|
{
|
||||||
|
return chatListener.remove(plugin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
|
||||||
//import org.mcteam.factions.Factions;
|
|
||||||
|
|
||||||
public class EssentialsChatPlayerListener extends PlayerListener
|
public class EssentialsChatPlayerListener extends PlayerListener
|
||||||
{
|
{
|
||||||
@ -20,7 +19,6 @@ public class EssentialsChatPlayerListener extends PlayerListener
|
|||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
private final transient Server server;
|
private final transient Server server;
|
||||||
private final transient Map<String, IEssentialsChatListener> listeners;
|
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)
|
public EssentialsChatPlayerListener(final Server server, final IEssentials ess, final Map<String, IEssentialsChatListener> listeners)
|
||||||
{
|
{
|
||||||
@ -37,8 +35,6 @@ public class EssentialsChatPlayerListener extends PlayerListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (factions != null && (factions.shouldLetFactionsHandleThisChat(event)))
|
|
||||||
// return;
|
|
||||||
for (IEssentialsChatListener listener : listeners.values())
|
for (IEssentialsChatListener listener : listeners.values())
|
||||||
{
|
{
|
||||||
if (listener.shouldHandleThisChat(event))
|
if (listener.shouldHandleThisChat(event))
|
||||||
@ -120,40 +116,10 @@ public class EssentialsChatPlayerListener extends PlayerListener
|
|||||||
|
|
||||||
for (IEssentialsChatListener listener : listeners.values())
|
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);
|
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);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.chat;
|
package com.earth2me.essentials.chat;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
|
||||||
|
|
||||||
@ -7,5 +8,5 @@ public interface IEssentialsChatListener
|
|||||||
{
|
{
|
||||||
boolean shouldHandleThisChat(PlayerChatEvent event);
|
boolean shouldHandleThisChat(PlayerChatEvent event);
|
||||||
|
|
||||||
String modifyMessage(PlayerChatEvent event, String message);
|
String modifyMessage(PlayerChatEvent event, Player target, String message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user