mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Don't allow whispering when ignored
This commit is contained in:
5 files changed
+36
-8
No files matched your search
+9
-4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@ public class ReplyCommand {
|
||||
final ComponentPlayerResult<CarbonPlayer> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user