Workaround fix for EssentialsChat integration not working on Essentials 2.8+. "chatTagReplaceString" setting now defaults to "[FACTION]" instead of "{FACTION}" since Essentials now converts curly-braces to square-braces for any tags specified in their chat format setting which Essentials doesn't recognize.

For those using Essentials 2.8.x, this should hopefully be handled automatically.
This commit is contained in:
Brettflan 2012-02-02 07:29:00 -06:00
parent 0abc3f397a
commit 1cd392f256
4 changed files with 10 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -67,7 +67,7 @@ public class Conf
public static boolean chatTagEnabled = true; public static boolean chatTagEnabled = true;
public static transient boolean chatTagHandledByAnotherPlugin = false; public static transient boolean chatTagHandledByAnotherPlugin = false;
public static boolean chatTagRelationColored = true; public static boolean chatTagRelationColored = true;
public static String chatTagReplaceString = "{FACTION}"; public static String chatTagReplaceString = "[FACTION]";
public static String chatTagInsertAfterString = ""; public static String chatTagInsertAfterString = "";
public static String chatTagInsertBeforeString = ""; public static String chatTagInsertBeforeString = "";
public static int chatTagInsertIndex = 1; public static int chatTagInsertIndex = 1;

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.integration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.earth2me.essentials.chat.EssentialsChat; import com.earth2me.essentials.chat.EssentialsChat;
@ -26,10 +27,17 @@ public class EssentialsFeatures
} }
public String modifyMessage(PlayerChatEvent event, Player target, String message) public String modifyMessage(PlayerChatEvent event, Player target, String message)
{ {
return message.replace("{FACTION}", P.p.getPlayerFactionTagRelation(event.getPlayer(), target)).replace("{FACTION_TITLE}", P.p.getPlayerTitle(event.getPlayer())); return message.replace(Conf.chatTagReplaceString, P.p.getPlayerFactionTagRelation(event.getPlayer(), target)).replace("[FACTION_TITLE]", P.p.getPlayerTitle(event.getPlayer()));
} }
}); });
P.p.log("Found and will integrate chat with "+essChat.getDescription().getFullName()); P.p.log("Found and will integrate chat with "+essChat.getDescription().getFullName());
// As of Essentials 2.8+, curly braces are not accepted and are instead replaced with square braces, so... deal with it
if (essChat.getDescription().getVersion().startsWith("2.8.") && Conf.chatTagReplaceString.contains("{"))
{
Conf.chatTagReplaceString = Conf.chatTagReplaceString.replace("{", "[").replace("}", "]");
P.p.log("NOTE: as of Essentials 2.8+, we've had to switch the default chat replacement tag from \"{FACTION}\" to \"[FACTION]\". This has automatically been updated for you.");
}
} }
catch (NoSuchMethodError ex) catch (NoSuchMethodError ex)
{ {