mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
vanish bypass perms and ignoreCancelled on chat
This commit is contained in:
1 parent
2964e7ef09
commit
9c576e8cdb
6 files changed
+20
-5
No files matched your search
@@ -37,7 +37,7 @@ public final class BukkitChatListener implements Listener {
|
|||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerChat(final @NonNull AsyncChatEvent event) {
|
public void onPlayerChat(final @NonNull AsyncChatEvent event) {
|
||||||
final var playerResult = this.carbonChat.server().player(event.getPlayer().getUniqueId()).join();
|
final var playerResult = this.carbonChat.server().player(event.getPlayer().getUniqueId()).join();
|
||||||
final @Nullable CarbonPlayer sender = playerResult.player();
|
final @Nullable CarbonPlayer sender = playerResult.player();
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ public class ContinueCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sender.awareOf(recipient) && !sender.hasPermission("carbon.seevanish.continue")) {
|
||||||
|
messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (sender.equals(recipient)) {
|
if (sender.equals(recipient)) {
|
||||||
messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender));
|
messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -48,6 +48,11 @@ public class ReplyCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sender.awareOf(recipient) && !sender.hasPermission("carbon.seevanish.reply")) {
|
||||||
|
messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (sender.equals(recipient)) {
|
if (sender.equals(recipient)) {
|
||||||
messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender));
|
messageService.whisperSelfError(sender, CarbonPlayer.renderName(sender));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class UnmuteCommand {
|
|||||||
final CarbonPlayerArgument carbonPlayerArgument
|
final CarbonPlayerArgument carbonPlayerArgument
|
||||||
) {
|
) {
|
||||||
final var command = commandManager.commandBuilder("unmute")
|
final var command = commandManager.commandBuilder("unmute")
|
||||||
// TODO: only suggest muted players :D
|
|
||||||
.argument(carbonPlayerArgument.newInstance(false, "player",
|
.argument(carbonPlayerArgument.newInstance(false, "player",
|
||||||
CarbonPlayerArgument.NO_SENDER.and((sender, player) -> {
|
CarbonPlayerArgument.NO_SENDER.and((sender, player) -> {
|
||||||
return !player.muteEntries().isEmpty();
|
return !player.muteEntries().isEmpty();
|
||||||
@@ -49,6 +48,7 @@ public class UnmuteCommand {
|
|||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("No target found to unmute.");
|
throw new IllegalStateException("No target found to unmute.");
|
||||||
}
|
}
|
||||||
|
|
||||||
messageService.playerAlertUnmuted(target);
|
messageService.playerAlertUnmuted(target);
|
||||||
messageService.broadcastPlayerUnmuted(sender, target.username());
|
messageService.broadcastPlayerUnmuted(sender, target.username());
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,12 @@ public class WhisperCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recipient.online() || !sender.awareOf(recipient)) {
|
if (!recipient.online()) {
|
||||||
|
messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sender.awareOf(recipient) && !sender.hasPermission("carbon.seevanish.whisper")) {
|
||||||
messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender));
|
messageService.whisperTargetOffline(sender, CarbonPlayer.renderName(sender));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
|
|||||||
protected long temporaryDisplayNameExpiration = -1;
|
protected long temporaryDisplayNameExpiration = -1;
|
||||||
|
|
||||||
// Whispers
|
// Whispers
|
||||||
protected @Nullable UUID lastWhisperTarget = null;
|
protected transient @Nullable UUID lastWhisperTarget = null;
|
||||||
protected @Nullable UUID whisperReplyTarget = null;
|
protected transient @Nullable UUID whisperReplyTarget = null;
|
||||||
|
|
||||||
// Administrative
|
// Administrative
|
||||||
protected boolean spying = false;
|
protected boolean spying = false;
|
||||||
|
|||||||
Reference in new issue
Block a user