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:
Brettflan 2011-07-20 19:31:28 -05:00
parent b650387dbc
commit bd5d7e185e
2 changed files with 29 additions and 12 deletions

View File

@ -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);
}

View File

@ -192,6 +192,7 @@ 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) {
try {
essChat = (EssentialsChat)test; essChat = (EssentialsChat)test;
essChat.addEssentialsChatListener("Factions", new IEssentialsChatListener() { essChat.addEssentialsChatListener("Factions", new IEssentialsChatListener() {
public boolean shouldHandleThisChat(PlayerChatEvent event) public boolean shouldHandleThisChat(PlayerChatEvent event)
@ -205,6 +206,10 @@ public class Factions extends JavaPlugin {
}); });
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() {
if (essChat != null) { if (essChat != null) {