Parse / strip chat color tokens based on if the commandSender has permission for chat colors
This commit is contained in:
parent
e08c5a4a3b
commit
2c0637b1d1
|
|
@ -186,6 +186,7 @@ public class ChatHandler {
|
||||||
uuid = player.getUniqueId();
|
uuid = player.getUniqueId();
|
||||||
senderName = player.getUsername();
|
senderName = player.getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Player> optionalPlayer = VelocityChat.getPlugin().getProxy().getPlayer(recipient);
|
Optional<Player> optionalPlayer = VelocityChat.getPlugin().getProxy().getPlayer(recipient);
|
||||||
if (optionalPlayer.isEmpty()) {
|
if (optionalPlayer.isEmpty()) {
|
||||||
targetUUID = ServerHandler.getPlayerUUID(recipient);
|
targetUUID = ServerHandler.getPlayerUUID(recipient);
|
||||||
|
|
@ -196,6 +197,12 @@ public class ChatHandler {
|
||||||
} else {
|
} else {
|
||||||
targetUUID = optionalPlayer.get().getUniqueId();
|
targetUUID = optionalPlayer.get().getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!commandSource.hasPermission("chat.format"))
|
||||||
|
message = Utility.stripTokens(message);
|
||||||
|
else
|
||||||
|
message = Utility.parseColors(message);
|
||||||
|
|
||||||
Mail mail = new Mail(uuid, targetUUID, message);
|
Mail mail = new Mail(uuid, targetUUID, message);
|
||||||
ChatUser chatUser = ChatUserManager.getChatUser(targetUUID);
|
ChatUser chatUser = ChatUserManager.getChatUser(targetUUID);
|
||||||
chatUser.addMail(mail);
|
chatUser.addMail(mail);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user