Fixed case-sensitive name matching for replacing names/nicknames
This commit is contained in:
1 parent
4f01c86877
commit
5e62786010
1 file changed
+2
-2
@@ -96,11 +96,11 @@ public class ChatListener implements Listener {
|
||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||
String name = onlinePlayer.getName();
|
||||
String nickName = PlainTextComponentSerializer.plainText().serialize(onlinePlayer.displayName());
|
||||
if (modifiableString.string().contains(name)) {
|
||||
if (modifiableString.string().toLowerCase().contains(name.toLowerCase())) {
|
||||
modifiableString.replace(Pattern.compile(name, Pattern.CASE_INSENSITIVE), mention.append(onlinePlayer.displayName()));
|
||||
playerToPing.add(onlinePlayer);
|
||||
}
|
||||
if (modifiableString.string().contains(nickName)) {
|
||||
if (modifiableString.string().toLowerCase().contains(nickName.toLowerCase())) {
|
||||
modifiableString.replace(Pattern.compile(nickName, Pattern.CASE_INSENSITIVE), mention.append(onlinePlayer.displayName()));
|
||||
playerToPing.add(onlinePlayer);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user