Fixed bug where party chat broke if the display name contained special characters

Fixes #1676
This commit is contained in:
TfT_02 2013-12-08 11:35:02 +01:00
parent 7a08343304
commit c9f1f8f662
2 changed files with 5 additions and 2 deletions

View File

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

View File

@ -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()) {