From c9f1f8f662b9d0871da75fce2661f94beaed4eac Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sun, 8 Dec 2013 11:35:02 +0100 Subject: [PATCH] Fixed bug where party chat broke if the display name contained special characters Fixes #1676 --- Changelog.txt | 3 ++- src/main/java/com/gmail/nossr50/chat/PartyChatManager.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 86828a393..6077d847f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -23,7 +23,8 @@ Version 1.4.08-dev = Fixed bug which prevented players from gaining Acrobatics XP when the setting 'Prevent_XP_After_Teleport' was set to false = Fixed bug where cooldown donor perks were reducing more than expected = Fixed bug where disabling hardcore mode for specific skills didn't work - = Fixed bug which caused the backup cleanup to delete old backups while it should've kept those + = Fixed bug which caused the backup cleanup to delete old backups while it should have kept those + = Fixed bug where party chat broke if the display name contained special characters ! Updated localization files ! Changed AxesCritical to CriticalHit in config file ! Changed several secondary ability permissions(deprecated versions still exist) diff --git a/src/main/java/com/gmail/nossr50/chat/PartyChatManager.java b/src/main/java/com/gmail/nossr50/chat/PartyChatManager.java index 1b2b24bd1..16d4a2620 100644 --- a/src/main/java/com/gmail/nossr50/chat/PartyChatManager.java +++ b/src/main/java/com/gmail/nossr50/chat/PartyChatManager.java @@ -1,5 +1,7 @@ package com.gmail.nossr50.chat; +import java.util.regex.Pattern; + import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -27,7 +29,7 @@ public class PartyChatManager extends ChatManager { @Override protected void sendMessage() { if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader())) { - message = message.replaceFirst(displayName, ChatColor.GOLD + displayName + ChatColor.RESET); + message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Pattern.quote(displayName) + ChatColor.RESET); } for (Player member : party.getOnlineMembers()) {