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

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