diff --git a/bukkit/src/main/java/net/draycia/carbon/bukkit/users/CarbonPlayerBukkit.java b/bukkit/src/main/java/net/draycia/carbon/bukkit/users/CarbonPlayerBukkit.java index 70b54e18..77aabf76 100644 --- a/bukkit/src/main/java/net/draycia/carbon/bukkit/users/CarbonPlayerBukkit.java +++ b/bukkit/src/main/java/net/draycia/carbon/bukkit/users/CarbonPlayerBukkit.java @@ -265,6 +265,11 @@ public final class CarbonPlayerBukkit extends CarbonPlayerCommon implements Forw return this.player() != null; } + @Override + public void whisperReplyTarget(@Nullable UUID uuid) { + this.carbonPlayer.whisperReplyTarget(uuid); + } + @Override public @Nullable UUID whisperReplyTarget() { return this.carbonPlayer.whisperReplyTarget(); diff --git a/common/src/main/java/net/draycia/carbon/common/CarbonChatCommon.java b/common/src/main/java/net/draycia/carbon/common/CarbonChatCommon.java index d3921687..eec69a67 100644 --- a/common/src/main/java/net/draycia/carbon/common/CarbonChatCommon.java +++ b/common/src/main/java/net/draycia/carbon/common/CarbonChatCommon.java @@ -2,9 +2,6 @@ package net.draycia.carbon.common; import com.google.inject.Injector; import net.draycia.carbon.api.CarbonChat; -import net.draycia.carbon.common.command.commands.WhisperCommand; -import net.draycia.carbon.common.listeners.DeafenHandler; -import net.draycia.carbon.common.listeners.MuteHandler; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.framework.qual.DefaultQualifier; 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 e3a669ac..0510a7eb 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 @@ -32,7 +32,7 @@ public class ReplyCommand { final UUID replyTarget = sender.whisperReplyTarget(); if (replyTarget == null) { - // TODO: send error message "no reply target" + messageService.replyTargetNotSet(sender, sender.displayName()); return; } @@ -40,12 +40,12 @@ public class ReplyCommand { final @MonotonicNonNull CarbonPlayer recipient = result.player(); if (recipient == null) { - // TODO: send error message "reply target not online" + messageService.replyTargetOffline(sender, sender.displayName()); return; } if (sender.equals(recipient)) { - // TODO: send error message "you cannot whisper yourself!" + messageService.whisperSelfError(sender, sender.displayName()); 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 5c2ddda5..e7cd2fc7 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 @@ -30,7 +30,7 @@ public class WhisperCommand { final CarbonPlayer recipient = handler.get("recipient"); if (sender.equals(recipient)) { - // TODO: send error message "you cannot whisper yourself!" + messageService.whisperSelfError(sender, sender.displayName()); return; } 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 3f8c8fa0..5a5567da 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 @@ -58,4 +58,22 @@ public interface CarbonMessageService { @Placeholder String message ); + @Message("reply.target.missing") + void replyTargetNotSet( + final Audience audience, + @Placeholder Component senderDisplayName + ); + + @Message("reply.target.offline") + void replyTargetOffline( + final Audience audience, + @Placeholder Component senderDisplayName + ); + + @Message("reply.target.self") + void whisperSelfError( + final Audience audience, + @Placeholder Component senderDisplayName + ); + } diff --git a/common/src/main/resources/locale/messages-en_US.properties b/common/src/main/resources/locale/messages-en_US.properties index 34bb76c6..8b2d223e 100644 --- a/common/src/main/resources/locale/messages-en_US.properties +++ b/common/src/main/resources/locale/messages-en_US.properties @@ -6,3 +6,6 @@ unsupported.legacy=Legacy color codes have been detected in a message. This channel.change=You are now messaging chat! whisper.to=[You] -> [] whisper.from=[] -> [You] +reply.target.missing=You have no-one to reply to. +reply.target.offline=That person is offline. +reply.target.self=You cannot whisper to yourself.