2
0
Эх сурвалжийг харах

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

Fixes #1676
TfT_02 11 жил өмнө
parent
commit
c9f1f8f662

+ 2 - 1
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)

+ 3 - 1
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()) {