Fixed double @ if someone doesn't have a nickname (or has the same nickname as the username)
This commit is contained in:
parent
ea051fd905
commit
5b06049265
|
|
@ -96,11 +96,12 @@ public class ChatListener implements Listener {
|
||||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||||
String name = onlinePlayer.getName();
|
String name = onlinePlayer.getName();
|
||||||
String nickName = PlainTextComponentSerializer.plainText().serialize(onlinePlayer.displayName());
|
String nickName = PlainTextComponentSerializer.plainText().serialize(onlinePlayer.displayName());
|
||||||
if (modifiableString.string().toLowerCase().contains(name.toLowerCase())) {
|
String message = modifiableString.string().toLowerCase();
|
||||||
|
if (message.contains(name.toLowerCase())) {
|
||||||
modifiableString.replace(Pattern.compile(name, Pattern.CASE_INSENSITIVE), mention.append(onlinePlayer.displayName()));
|
modifiableString.replace(Pattern.compile(name, Pattern.CASE_INSENSITIVE), mention.append(onlinePlayer.displayName()));
|
||||||
playerToPing.add(onlinePlayer);
|
playerToPing.add(onlinePlayer);
|
||||||
}
|
}
|
||||||
if (modifiableString.string().toLowerCase().contains(nickName.toLowerCase())) {
|
if (!name.equalsIgnoreCase(nickName) && message.contains(nickName.toLowerCase())) {
|
||||||
modifiableString.replace(Pattern.compile(nickName, Pattern.CASE_INSENSITIVE), mention.append(onlinePlayer.displayName()));
|
modifiableString.replace(Pattern.compile(nickName, Pattern.CASE_INSENSITIVE), mention.append(onlinePlayer.displayName()));
|
||||||
playerToPing.add(onlinePlayer);
|
playerToPing.add(onlinePlayer);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user