Well, this is an odd and kludgy fix... only thing I can find that allows the integration to work correctly and not give an error whether EssentialsChat is present or not
This commit is contained in:
parent
b650387dbc
commit
bd5d7e185e
@ -0,0 +1,12 @@
|
|||||||
|
package com.earth2me.essentials.chat;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IEssentialsChatListener
|
||||||
|
{
|
||||||
|
boolean shouldHandleThisChat(PlayerChatEvent event);
|
||||||
|
|
||||||
|
String modifyMessage(PlayerChatEvent event, Player target, String message);
|
||||||
|
}
|
@ -192,18 +192,23 @@ public class Factions extends JavaPlugin {
|
|||||||
Plugin test = this.getServer().getPluginManager().getPlugin("EssentialsChat");
|
Plugin test = this.getServer().getPluginManager().getPlugin("EssentialsChat");
|
||||||
|
|
||||||
if (test != null) {
|
if (test != null) {
|
||||||
essChat = (EssentialsChat)test;
|
try {
|
||||||
essChat.addEssentialsChatListener("Factions", new IEssentialsChatListener() {
|
essChat = (EssentialsChat)test;
|
||||||
public boolean shouldHandleThisChat(PlayerChatEvent event)
|
essChat.addEssentialsChatListener("Factions", new IEssentialsChatListener() {
|
||||||
{
|
public boolean shouldHandleThisChat(PlayerChatEvent event)
|
||||||
return shouldLetFactionsHandleThisChat(event);
|
{
|
||||||
}
|
return shouldLetFactionsHandleThisChat(event);
|
||||||
public String modifyMessage(PlayerChatEvent event, Player target, String message)
|
}
|
||||||
{
|
public String modifyMessage(PlayerChatEvent event, Player target, String message)
|
||||||
return message.replace("{FACTION}", getPlayerFactionTagRelation(event.getPlayer(), target)).replace("{FACTION_TITLE}", getPlayerTitle(event.getPlayer()));
|
{
|
||||||
}
|
return message.replace("{FACTION}", getPlayerFactionTagRelation(event.getPlayer(), target)).replace("{FACTION_TITLE}", getPlayerTitle(event.getPlayer()));
|
||||||
});
|
}
|
||||||
Factions.log("Found and will integrate chat with "+test.getDescription().getFullName());
|
});
|
||||||
|
Factions.log("Found and will integrate chat with "+test.getDescription().getFullName());
|
||||||
|
}
|
||||||
|
catch (NoSuchMethodError ex) {
|
||||||
|
essChat = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void unhookEssentialsChat() {
|
private void unhookEssentialsChat() {
|
||||||
|
Loading…
Reference in New Issue
Block a user