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:
parent
7a38ee42a7
commit
784895c779
Binary file not shown.
BIN
lib/EssentialsChat_2.8.1.jar
Normal file
BIN
lib/EssentialsChat_2.8.1.jar
Normal file
Binary file not shown.
@ -56,7 +56,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;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user