Fix ignore in private message
This commit is contained in:
parent
3fd7bbfece
commit
250aeb5d16
|
|
@ -42,8 +42,8 @@ public class ChatHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void privateMessage(Player player, String target, String message) {
|
public void privateMessage(Player player, String target, String message) {
|
||||||
ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
// ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
||||||
user.setReplyTarget(target);
|
// user.setReplyTarget(target);
|
||||||
String updatedMessage = RegexManager.replaceText(player.getName(), player.getUniqueId(), message); // todo a better way for this
|
String updatedMessage = RegexManager.replaceText(player.getName(), player.getUniqueId(), message); // todo a better way for this
|
||||||
if(updatedMessage == null) {
|
if(updatedMessage == null) {
|
||||||
GalaxyUtility.sendBlockedNotification("DM Language", player, message, target);
|
GalaxyUtility.sendBlockedNotification("DM Language", player, message, target);
|
||||||
|
|
|
||||||
|
|
@ -40,16 +40,17 @@ public class ChatListener implements Listener, ChatRenderer {
|
||||||
+ " tried to say: "
|
+ " tried to say: "
|
||||||
+ PlainComponentSerializer.plain().serialize(event.message()) + "</red>");
|
+ PlainComponentSerializer.plain().serialize(event.message()) + "</red>");
|
||||||
|
|
||||||
Bukkit.getOnlinePlayers().forEach(a ->{
|
Bukkit.broadcast(blockedNotification, "chat.alert-blocked");
|
||||||
if (a.hasPermission("chat.alert-blocked")) {
|
// Bukkit.getOnlinePlayers().forEach(a ->{
|
||||||
a.sendMessage(blockedNotification);//TODO make configurable (along with all the messages)
|
// if (a.hasPermission("chat.alert-blocked")) {
|
||||||
}
|
// a.sendMessage(blockedNotification);//TODO make configurable (along with all the messages)
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
// ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
||||||
|
|
||||||
event.viewers().removeIf(audience -> audience instanceof Player receiver
|
event.viewers().removeIf(audience -> audience instanceof Player receiver
|
||||||
&& ChatUserManager.getChatUser(receiver.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()));
|
&& ChatUserManager.getChatUser(receiver.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()));
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,12 @@ public class PluginMessage implements PluginMessageListener {
|
||||||
UUID uuid = UUID.fromString(in.readUTF());
|
UUID uuid = UUID.fromString(in.readUTF());
|
||||||
String target = in.readUTF();
|
String target = in.readUTF();
|
||||||
Player p = Bukkit.getPlayer(uuid);
|
Player p = Bukkit.getPlayer(uuid);
|
||||||
|
String message = in.readUTF();
|
||||||
|
UUID targetuuid = UUID.fromString(in.readUTF());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
||||||
if (!chatUser.getIgnoredPlayers().contains(uuid)) {
|
if (!chatUser.getIgnoredPlayers().contains(targetuuid)) {
|
||||||
p.sendMessage(GsonComponentSerializer.gson().deserialize(in.readUTF()));
|
p.sendMessage(GsonComponentSerializer.gson().deserialize(message));
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 1); // todo load this from config
|
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 1); // todo load this from config
|
||||||
ChatUser user = ChatUserManager.getChatUser(uuid);
|
ChatUser user = ChatUserManager.getChatUser(uuid);
|
||||||
user.setReplyTarget(target);
|
user.setReplyTarget(target);
|
||||||
|
|
@ -53,10 +55,12 @@ public class PluginMessage implements PluginMessageListener {
|
||||||
UUID uuid = UUID.fromString(in.readUTF());
|
UUID uuid = UUID.fromString(in.readUTF());
|
||||||
String target = in.readUTF();
|
String target = in.readUTF();
|
||||||
Player p = Bukkit.getPlayer(uuid);
|
Player p = Bukkit.getPlayer(uuid);
|
||||||
|
String message = in.readUTF();
|
||||||
|
UUID targetuuid = UUID.fromString(in.readUTF());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
||||||
if (!chatUser.getIgnoredPlayers().contains(uuid)) {
|
if (!chatUser.getIgnoredPlayers().contains(targetuuid)) {
|
||||||
p.sendMessage(GsonComponentSerializer.gson().deserialize(in.readUTF()));
|
p.sendMessage(GsonComponentSerializer.gson().deserialize(message));
|
||||||
ChatUser user = ChatUserManager.getChatUser(uuid);
|
ChatUser user = ChatUserManager.getChatUser(uuid);
|
||||||
user.setReplyTarget(target);
|
user.setReplyTarget(target);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ public class ChatHandler {
|
||||||
buf.writeUTF(player.getUniqueId().toString());
|
buf.writeUTF(player.getUniqueId().toString());
|
||||||
buf.writeUTF(player2.getUsername());
|
buf.writeUTF(player2.getUsername());
|
||||||
buf.writeUTF(GsonComponentSerializer.gson().serialize(component));
|
buf.writeUTF(GsonComponentSerializer.gson().serialize(component));
|
||||||
|
buf.writeUTF(player2.getUniqueId().toString());
|
||||||
serverConnection.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), buf.toByteArray());
|
serverConnection.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), buf.toByteArray());
|
||||||
|
|
||||||
//redirect to the receiver
|
//redirect to the receiver
|
||||||
|
|
@ -67,6 +68,7 @@ public class ChatHandler {
|
||||||
buf.writeUTF(player2.getUniqueId().toString());
|
buf.writeUTF(player2.getUniqueId().toString());
|
||||||
buf.writeUTF(player.getUsername());
|
buf.writeUTF(player.getUsername());
|
||||||
buf.writeUTF(GsonComponentSerializer.gson().serialize(component));
|
buf.writeUTF(GsonComponentSerializer.gson().serialize(component));
|
||||||
|
buf.writeUTF(player.getUniqueId().toString());
|
||||||
serverConnection.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), buf.toByteArray());
|
serverConnection.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), buf.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user