diff --git a/common/src/main/java/net/draycia/carbon/common/command/commands/ContinueCommand.java b/common/src/main/java/net/draycia/carbon/common/command/commands/ContinueCommand.java index aac4c0ef..18ae4066 100644 --- a/common/src/main/java/net/draycia/carbon/common/command/commands/ContinueCommand.java +++ b/common/src/main/java/net/draycia/carbon/common/command/commands/ContinueCommand.java @@ -62,6 +62,11 @@ public class ContinueCommand { .player(whisperTarget).join(); final @MonotonicNonNull CarbonPlayer recipient = result.player(); + if (sender.equals(recipient)) { + messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender)); + return; + } + if (!recipient.online() || (!sender.awareOf(recipient) && !sender.hasPermission("carbon.seevanish.whisper")) @@ -73,13 +78,13 @@ public class ContinueCommand { return; } - if (sender.equals(recipient)) { - messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender)); + if (sender.ignoring(recipient)) { + messageService.whisperIgnoringTarget(sender, CarbonPlayer.renderName(recipient)); return; } - if (!recipient.online()) { - messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender)); + if (recipient.ignoring(sender)) { + messageService.whisperTargetIgnoring(sender, CarbonPlayer.renderName(recipient)); return; } diff --git a/common/src/main/java/net/draycia/carbon/common/command/commands/ReplyCommand.java b/common/src/main/java/net/draycia/carbon/common/command/commands/ReplyCommand.java index a64128be..89fa114f 100644 --- a/common/src/main/java/net/draycia/carbon/common/command/commands/ReplyCommand.java +++ b/common/src/main/java/net/draycia/carbon/common/command/commands/ReplyCommand.java @@ -64,6 +64,11 @@ public class ReplyCommand { final ComponentPlayerResult result = carbonChat.server().player(replyTarget).join(); final @MonotonicNonNull CarbonPlayer recipient = result.player(); + if (sender.equals(recipient)) { + messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender)); + return; + } + if (!recipient.online() || (!sender.awareOf(recipient) && !sender.hasPermission("carbon.seevanish.whisper")) @@ -75,13 +80,13 @@ public class ReplyCommand { return; } - if (sender.equals(recipient)) { - messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender)); + if (sender.ignoring(recipient)) { + messageService.whisperIgnoringTarget(sender, CarbonPlayer.renderName(recipient)); return; } - if (!recipient.online()) { - messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender)); + if (recipient.ignoring(sender)) { + messageService.whisperTargetIgnoring(sender, CarbonPlayer.renderName(recipient)); return; } diff --git a/common/src/main/java/net/draycia/carbon/common/command/commands/WhisperCommand.java b/common/src/main/java/net/draycia/carbon/common/command/commands/WhisperCommand.java index 7893ca68..688c382d 100644 --- a/common/src/main/java/net/draycia/carbon/common/command/commands/WhisperCommand.java +++ b/common/src/main/java/net/draycia/carbon/common/command/commands/WhisperCommand.java @@ -65,6 +65,16 @@ public class WhisperCommand { return; } + if (sender.ignoring(recipient)) { + messageService.whisperIgnoringTarget(sender, CarbonPlayer.renderName(recipient)); + return; + } + + if (recipient.ignoring(sender)) { + messageService.whisperTargetIgnoring(sender, CarbonPlayer.renderName(recipient)); + return; + } + messageService.whisperSender(new SourcedAudience(sender, sender), CarbonPlayer.renderName(sender), CarbonPlayer.renderName(recipient), message); diff --git a/common/src/main/java/net/draycia/carbon/common/messages/CarbonMessageService.java b/common/src/main/java/net/draycia/carbon/common/messages/CarbonMessageService.java index b1a8da2d..cacc50b8 100644 --- a/common/src/main/java/net/draycia/carbon/common/messages/CarbonMessageService.java +++ b/common/src/main/java/net/draycia/carbon/common/messages/CarbonMessageService.java @@ -299,4 +299,10 @@ public interface CarbonMessageService { @Message("ignore.no_longer_ignoring") void noLongerIgnoring(final Audience audience, final @Placeholder Component target); + @Message("whisper.ignoring_target") + void whisperIgnoringTarget(final Audience audience, final @Placeholder Component target); + + @Message("whisper.ignored_by_target") + void whisperTargetIgnoring(final Audience audience, final @Placeholder Component target); + } diff --git a/common/src/main/resources/locale/messages-en_US.properties b/common/src/main/resources/locale/messages-en_US.properties index 093dac3e..74d2231d 100644 --- a/common/src/main/resources/locale/messages-en_US.properties +++ b/common/src/main/resources/locale/messages-en_US.properties @@ -55,3 +55,5 @@ command.help.click_for_previous_page=Click for previous page ignore.exempt=You cannot ignore ignore.now_ignoring=You are now ignoring ignore.no_longer_ignoring=You are no longer ignoring +whisper.ignoring_target=You are ignoring +whisper.ignored_by_target= is ignoring you