From cbcd145360b391f70e9d1a1a1b3b60c867ca43bf Mon Sep 17 00:00:00 2001 From: Draycia Date: Fri, 2 Jun 2023 19:36:44 -0700 Subject: [PATCH] Add missing docs for ChannelMessage --- .../java/net/draycia/carbon/api/users/CarbonPlayer.java | 9 ++++++++- .../carbon/common/command/commands/WhisperCommand.java | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/net/draycia/carbon/api/users/CarbonPlayer.java b/api/src/main/java/net/draycia/carbon/api/users/CarbonPlayer.java index 714e7c2b..e5c557e4 100644 --- a/api/src/main/java/net/draycia/carbon/api/users/CarbonPlayer.java +++ b/api/src/main/java/net/draycia/carbon/api/users/CarbonPlayer.java @@ -155,7 +155,7 @@ public interface CarbonPlayer extends Audience, Identified { void selectedChannel(final @Nullable ChatChannel chatChannel); /** - * Determines which channel the message should go to, and removes any channel prefixes from the message + * Determines which channel the message should go to, and removes any channel prefixes from the message. * * @param message the message to be sent * @return the channel and message @@ -163,6 +163,13 @@ public interface CarbonPlayer extends Audience, Identified { */ ChannelMessage channelForMessage(final Component message); + /** + * A message and which channel it should be sent in. + * + * @param message The channel message without any prefixes + * @param channel The channel the message should be sent to + * @since 2.1.0 + */ record ChannelMessage(Component message, @Nullable ChatChannel channel) {} /** 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 4d245b62..02bc55d5 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 @@ -98,10 +98,10 @@ public class WhisperCommand extends CarbonCommand { final String message = handler.get("message"); final CarbonPlayer recipient = handler.get("player"); -// if (sender.equals(recipient)) { -// this.carbonMessages.whisperSelfError(sender, CarbonPlayer.renderName(sender)); -// return; -// } + if (sender.equals(recipient)) { + this.carbonMessages.whisperSelfError(sender, CarbonPlayer.renderName(sender)); + return; + } if (!recipient.online() || !sender.awareOf(recipient) && !sender.hasPermission("carbon.whisper.vanished")) { final var rawNameInput = CloudUtils.rawInputByMatchingName(handler.getRawInput(), recipient);