mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Allow console to use mute/unmute/debug
This commit is contained in:
1 parent
ac2974877c
commit
d6f3f9a633
3 files changed
+17
-18
No files matched your search
@@ -72,16 +72,18 @@ public final class DebugCommand extends CarbonCommand {
|
||||
.optional("player", this.parserFactory.carbonPlayer(),
|
||||
richDescription(this.carbonMessages.commandDebugArgumentPlayer()))
|
||||
.permission("carbon.debug")
|
||||
.senderType(PlayerCommander.class)
|
||||
.senderType(Commander.class)
|
||||
.commandDescription(richDescription(this.carbonMessages.commandDebugDescription()))
|
||||
.handler(handler -> {
|
||||
final CarbonPlayer sender = handler.sender().carbonPlayer();
|
||||
final Commander sender = handler.sender();
|
||||
final CarbonPlayer target;
|
||||
|
||||
if (handler.contains("player")) {
|
||||
target = handler.get("player");
|
||||
} else if (sender instanceof PlayerCommander playerCommander) {
|
||||
target = playerCommander.carbonPlayer();
|
||||
} else {
|
||||
target = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(
|
||||
|
||||
@@ -82,10 +82,10 @@ public final class MuteCommand extends CarbonCommand {
|
||||
.withComponent(uuidParser())
|
||||
)
|
||||
.permission("carbon.mute")
|
||||
.senderType(PlayerCommander.class)
|
||||
.senderType(Commander.class)
|
||||
.commandDescription(richDescription(this.carbonMessages.commandMuteDescription()))
|
||||
.handler(handler -> {
|
||||
final CarbonPlayer sender = handler.sender().carbonPlayer();
|
||||
final Commander sender = handler.sender();
|
||||
final CarbonPlayer target;
|
||||
|
||||
if (handler.contains("player")) {
|
||||
@@ -103,14 +103,15 @@ public final class MuteCommand extends CarbonCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
this.carbonMessages.muteAlertRecipient(target);
|
||||
|
||||
if (!sender.equals(target)) {
|
||||
this.carbonMessages.muteAlertPlayers(sender, target.displayName());
|
||||
if (sender instanceof PlayerCommander playerCommander && playerCommander.carbonPlayer().equals(target)) {
|
||||
this.carbonMessages.muteExempt(playerCommander);
|
||||
}
|
||||
|
||||
this.carbonMessages.muteAlertRecipient(target);
|
||||
this.carbonMessages.muteAlertRecipient(this.server.console());
|
||||
|
||||
for (final var player : this.server.players()) {
|
||||
if (player.equals(target) || player.equals(sender)) {
|
||||
if (player.equals(target)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.draycia.carbon.common.command.CarbonCommand;
|
||||
import net.draycia.carbon.common.command.CommandSettings;
|
||||
import net.draycia.carbon.common.command.Commander;
|
||||
import net.draycia.carbon.common.command.ParserFactory;
|
||||
import net.draycia.carbon.common.command.PlayerCommander;
|
||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -82,10 +81,10 @@ public final class UnmuteCommand extends CarbonCommand {
|
||||
.withComponent(uuidParser())
|
||||
)
|
||||
.permission("carbon.mute.unmute")
|
||||
.senderType(PlayerCommander.class)
|
||||
.senderType(Commander.class)
|
||||
.commandDescription(richDescription(this.carbonMessages.commandUnmuteDescription()))
|
||||
.handler(handler -> {
|
||||
final CarbonPlayer sender = handler.sender().carbonPlayer();
|
||||
final Commander sender = handler.sender();
|
||||
final CarbonPlayer target;
|
||||
|
||||
if (handler.contains("player")) {
|
||||
@@ -99,13 +98,10 @@ public final class UnmuteCommand extends CarbonCommand {
|
||||
}
|
||||
|
||||
this.carbonMessages.unmuteAlertRecipient(target);
|
||||
|
||||
if (!sender.equals(target)) {
|
||||
this.carbonMessages.unmuteAlertPlayers(sender, target.displayName());
|
||||
}
|
||||
this.carbonMessages.unmuteAlertPlayers(this.server.console(), target.displayName());
|
||||
|
||||
for (final var player : this.server.players()) {
|
||||
if (player.equals(target) || player.equals(sender)) {
|
||||
if (player.equals(target)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user