mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +00:00
Add whisper.send and whisper.receive permissions (#495)
This commit is contained in:
1 parent
0e462568f3
commit
c1d83e99bc
3 files changed
+23
No files matched your search
@@ -175,6 +175,11 @@ public final class WhisperCommand extends CarbonCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sender.hasPermission("carbon.whisper.send")) {
|
||||||
|
this.messages.whisperNoPermissionSend(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final String recipientUsername = recipient.username();
|
final String recipientUsername = recipient.username();
|
||||||
if (!this.network.online(recipient) || !sender.awareOf(recipient) && !sender.hasPermission("carbon.whisper.vanished")) {
|
if (!this.network.online(recipient) || !sender.awareOf(recipient) && !sender.hasPermission("carbon.whisper.vanished")) {
|
||||||
final var exception = new CarbonPlayerParser.ParseException(
|
final var exception = new CarbonPlayerParser.ParseException(
|
||||||
@@ -220,6 +225,11 @@ public final class WhisperCommand extends CarbonCommand {
|
|||||||
this.messages.whisperSender(SourcedAudience.of(sender, sender), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, privateChatEvent.message())
|
this.messages.whisperSender(SourcedAudience.of(sender, sender), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, privateChatEvent.message())
|
||||||
);
|
);
|
||||||
if (localRecipient) {
|
if (localRecipient) {
|
||||||
|
if (!recipient.hasPermission("carbon.whisper.receive")) {
|
||||||
|
this.messages.whisperNoPermissionReceive(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
message.sendMessage(
|
message.sendMessage(
|
||||||
recipient,
|
recipient,
|
||||||
ChatType.chatType(this.rawChatKey),
|
ChatType.chatType(this.rawChatKey),
|
||||||
@@ -259,6 +269,11 @@ public final class WhisperCommand extends CarbonCommand {
|
|||||||
final String recipientUsername = recipient.username();
|
final String recipientUsername = recipient.username();
|
||||||
final Component recipientDisplayName = recipient.displayName();
|
final Component recipientDisplayName = recipient.displayName();
|
||||||
|
|
||||||
|
if (!recipient.hasPermission("carbon.whisper.receive")) {
|
||||||
|
this.messages.whisperNoPermissionReceive(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
recipient.whisperReplyTarget(sender.uuid());
|
recipient.whisperReplyTarget(sender.uuid());
|
||||||
SourcedAudience.of(sender, recipient).sendMessage(
|
SourcedAudience.of(sender, recipient).sendMessage(
|
||||||
this.messages.whisperRecipient(SourcedAudience.of(sender, recipient), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, packet.message())
|
this.messages.whisperRecipient(SourcedAudience.of(sender, recipient), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, packet.message())
|
||||||
|
|||||||
@@ -190,6 +190,12 @@ public interface CarbonMessages {
|
|||||||
@Message("whisper.toggled.off")
|
@Message("whisper.toggled.off")
|
||||||
void whispersToggledOff(final Audience audience);
|
void whispersToggledOff(final Audience audience);
|
||||||
|
|
||||||
|
@Message("whisper.no_permission.send")
|
||||||
|
void whisperNoPermissionSend(final Audience audience);
|
||||||
|
|
||||||
|
@Message("whisper.no_permission.receive")
|
||||||
|
void whisperNoPermissionReceive(final Audience audience);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* =============================================================
|
* =============================================================
|
||||||
* ========================= Nicknames =========================
|
* ========================= Nicknames =========================
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ whisper.from.spy=<red>SPY [</red><green><sender_display_name></green>]<red> -> [
|
|||||||
whisper.ignored_by_target=<red><target> <red>is ignoring you
|
whisper.ignored_by_target=<red><target> <red>is ignoring you
|
||||||
whisper.ignoring_target=<red>You are ignoring <target>
|
whisper.ignoring_target=<red>You are ignoring <target>
|
||||||
whisper.ignoring_all=<red>You cannot send messages while they are ignored!
|
whisper.ignoring_all=<red>You cannot send messages while they are ignored!
|
||||||
|
whisper.no_permission.receive=<red>That player doesn't have permission to receive messages!
|
||||||
|
whisper.no_permission.send=<red>You don't have permission to send whispers!
|
||||||
whisper.to=<click:suggest_command:'/whisper <recipient_username> '><hover:show_text:'Click to start another message to <recipient_display_name>'><gold>[<green>You</green>] -> [<green><recipient_display_name></green>] <message>
|
whisper.to=<click:suggest_command:'/whisper <recipient_username> '><hover:show_text:'Click to start another message to <recipient_display_name>'><gold>[<green>You</green>] -> [<green><recipient_display_name></green>] <message>
|
||||||
whisper.toggled.on=Now receiving private messages.
|
whisper.toggled.on=Now receiving private messages.
|
||||||
whisper.toggled.off=No longer receiving private messages.
|
whisper.toggled.off=No longer receiving private messages.
|
||||||
|
|||||||
Reference in new issue
Block a user