mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 06:28:53 +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(),
|
.optional("player", this.parserFactory.carbonPlayer(),
|
||||||
richDescription(this.carbonMessages.commandDebugArgumentPlayer()))
|
richDescription(this.carbonMessages.commandDebugArgumentPlayer()))
|
||||||
.permission("carbon.debug")
|
.permission("carbon.debug")
|
||||||
.senderType(PlayerCommander.class)
|
.senderType(Commander.class)
|
||||||
.commandDescription(richDescription(this.carbonMessages.commandDebugDescription()))
|
.commandDescription(richDescription(this.carbonMessages.commandDebugDescription()))
|
||||||
.handler(handler -> {
|
.handler(handler -> {
|
||||||
final CarbonPlayer sender = handler.sender().carbonPlayer();
|
final Commander sender = handler.sender();
|
||||||
final CarbonPlayer target;
|
final CarbonPlayer target;
|
||||||
|
|
||||||
if (handler.contains("player")) {
|
if (handler.contains("player")) {
|
||||||
target = handler.get("player");
|
target = handler.get("player");
|
||||||
|
} else if (sender instanceof PlayerCommander playerCommander) {
|
||||||
|
target = playerCommander.carbonPlayer();
|
||||||
} else {
|
} else {
|
||||||
target = sender;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ public final class MuteCommand extends CarbonCommand {
|
|||||||
.withComponent(uuidParser())
|
.withComponent(uuidParser())
|
||||||
)
|
)
|
||||||
.permission("carbon.mute")
|
.permission("carbon.mute")
|
||||||
.senderType(PlayerCommander.class)
|
.senderType(Commander.class)
|
||||||
.commandDescription(richDescription(this.carbonMessages.commandMuteDescription()))
|
.commandDescription(richDescription(this.carbonMessages.commandMuteDescription()))
|
||||||
.handler(handler -> {
|
.handler(handler -> {
|
||||||
final CarbonPlayer sender = handler.sender().carbonPlayer();
|
final Commander sender = handler.sender();
|
||||||
final CarbonPlayer target;
|
final CarbonPlayer target;
|
||||||
|
|
||||||
if (handler.contains("player")) {
|
if (handler.contains("player")) {
|
||||||
@@ -103,14 +103,15 @@ public final class MuteCommand extends CarbonCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.carbonMessages.muteAlertRecipient(target);
|
if (sender instanceof PlayerCommander playerCommander && playerCommander.carbonPlayer().equals(target)) {
|
||||||
|
this.carbonMessages.muteExempt(playerCommander);
|
||||||
if (!sender.equals(target)) {
|
|
||||||
this.carbonMessages.muteAlertPlayers(sender, target.displayName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.carbonMessages.muteAlertRecipient(target);
|
||||||
|
this.carbonMessages.muteAlertRecipient(this.server.console());
|
||||||
|
|
||||||
for (final var player : this.server.players()) {
|
for (final var player : this.server.players()) {
|
||||||
if (player.equals(target) || player.equals(sender)) {
|
if (player.equals(target)) {
|
||||||
continue;
|
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.CommandSettings;
|
||||||
import net.draycia.carbon.common.command.Commander;
|
import net.draycia.carbon.common.command.Commander;
|
||||||
import net.draycia.carbon.common.command.ParserFactory;
|
import net.draycia.carbon.common.command.ParserFactory;
|
||||||
import net.draycia.carbon.common.command.PlayerCommander;
|
|
||||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
@@ -82,10 +81,10 @@ public final class UnmuteCommand extends CarbonCommand {
|
|||||||
.withComponent(uuidParser())
|
.withComponent(uuidParser())
|
||||||
)
|
)
|
||||||
.permission("carbon.mute.unmute")
|
.permission("carbon.mute.unmute")
|
||||||
.senderType(PlayerCommander.class)
|
.senderType(Commander.class)
|
||||||
.commandDescription(richDescription(this.carbonMessages.commandUnmuteDescription()))
|
.commandDescription(richDescription(this.carbonMessages.commandUnmuteDescription()))
|
||||||
.handler(handler -> {
|
.handler(handler -> {
|
||||||
final CarbonPlayer sender = handler.sender().carbonPlayer();
|
final Commander sender = handler.sender();
|
||||||
final CarbonPlayer target;
|
final CarbonPlayer target;
|
||||||
|
|
||||||
if (handler.contains("player")) {
|
if (handler.contains("player")) {
|
||||||
@@ -99,13 +98,10 @@ public final class UnmuteCommand extends CarbonCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.carbonMessages.unmuteAlertRecipient(target);
|
this.carbonMessages.unmuteAlertRecipient(target);
|
||||||
|
this.carbonMessages.unmuteAlertPlayers(this.server.console(), target.displayName());
|
||||||
if (!sender.equals(target)) {
|
|
||||||
this.carbonMessages.unmuteAlertPlayers(sender, target.displayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final var player : this.server.players()) {
|
for (final var player : this.server.players()) {
|
||||||
if (player.equals(target) || player.equals(sender)) {
|
if (player.equals(target)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user