mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +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();
|
.player(whisperTarget).join();
|
||||||
final @MonotonicNonNull CarbonPlayer recipient = result.player();
|
final @MonotonicNonNull CarbonPlayer recipient = result.player();
|
||||||
|
|
||||||
|
if (sender.equals(recipient)) {
|
||||||
|
messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!recipient.online()
|
if (!recipient.online()
|
||||||
|| (!sender.awareOf(recipient)
|
|| (!sender.awareOf(recipient)
|
||||||
&& !sender.hasPermission("carbon.seevanish.whisper"))
|
&& !sender.hasPermission("carbon.seevanish.whisper"))
|
||||||
@@ -73,13 +78,13 @@ public class ContinueCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender.equals(recipient)) {
|
if (sender.ignoring(recipient)) {
|
||||||
messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender));
|
messageService.whisperIgnoringTarget(sender, CarbonPlayer.renderName(recipient));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recipient.online()) {
|
if (recipient.ignoring(sender)) {
|
||||||
messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender));
|
messageService.whisperTargetIgnoring(sender, CarbonPlayer.renderName(recipient));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ public class ReplyCommand {
|
|||||||
final ComponentPlayerResult<CarbonPlayer> result = carbonChat.server().player(replyTarget).join();
|
final ComponentPlayerResult<CarbonPlayer> result = carbonChat.server().player(replyTarget).join();
|
||||||
final @MonotonicNonNull CarbonPlayer recipient = result.player();
|
final @MonotonicNonNull CarbonPlayer recipient = result.player();
|
||||||
|
|
||||||
|
if (sender.equals(recipient)) {
|
||||||
|
messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!recipient.online()
|
if (!recipient.online()
|
||||||
|| (!sender.awareOf(recipient)
|
|| (!sender.awareOf(recipient)
|
||||||
&& !sender.hasPermission("carbon.seevanish.whisper"))
|
&& !sender.hasPermission("carbon.seevanish.whisper"))
|
||||||
@@ -75,13 +80,13 @@ public class ReplyCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender.equals(recipient)) {
|
if (sender.ignoring(recipient)) {
|
||||||
messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender));
|
messageService.whisperIgnoringTarget(sender, CarbonPlayer.renderName(recipient));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recipient.online()) {
|
if (recipient.ignoring(sender)) {
|
||||||
messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender));
|
messageService.whisperTargetIgnoring(sender, CarbonPlayer.renderName(recipient));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,16 @@ public class WhisperCommand {
|
|||||||
return;
|
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),
|
messageService.whisperSender(new SourcedAudience(sender, sender),
|
||||||
CarbonPlayer.renderName(sender), CarbonPlayer.renderName(recipient), message);
|
CarbonPlayer.renderName(sender), CarbonPlayer.renderName(recipient), message);
|
||||||
|
|
||||||
|
|||||||
@@ -299,4 +299,10 @@ public interface CarbonMessageService {
|
|||||||
@Message("ignore.no_longer_ignoring")
|
@Message("ignore.no_longer_ignoring")
|
||||||
void noLongerIgnoring(final Audience audience, final @Placeholder Component target);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -55,3 +55,5 @@ command.help.click_for_previous_page=Click for previous page
|
|||||||
ignore.exempt=<red>You cannot ignore <target>
|
ignore.exempt=<red>You cannot ignore <target>
|
||||||
ignore.now_ignoring=<green>You are now ignoring <target>
|
ignore.now_ignoring=<green>You are now ignoring <target>
|
||||||
ignore.no_longer_ignoring=<green>You are no longer ignoring <target>
|
ignore.no_longer_ignoring=<green>You are no longer ignoring <target>
|
||||||
|
whisper.ignoring_target=<red>You are ignoring <target>
|
||||||
|
whisper.ignored_by_target=<red><target> <red>is ignoring you
|
||||||
Reference in new issue
Block a user