[NOJANG] Allow commands to send feedback as chat messages, if command feedback is disabled

This commit is contained in:
2025-04-28 14:01:14 +02:00
parent c6e5549fa9
commit 4a0314462e
2 changed files with 15 additions and 2 deletions

View File

@@ -8,13 +8,23 @@ import net.minecraft.commands.CommandSourceStack;
import java.util.function.Supplier;
import static net.minecraft.world.level.GameRules.RULE_SENDCOMMANDFEEDBACK;
@RequiredArgsConstructor(staticName = "of")
public class BridgedCommandSourceStack {
private final CommandSourceStack internal;
public void sendSuccess(Supplier<Component> supplier, boolean bl) {
internal.sendSuccess(() -> ChatUtils.adventureToMojang(supplier.get()), bl);
if (!internal.getServer().getGameRules().getBoolean(RULE_SENDCOMMANDFEEDBACK)) {
internal.sendSystemMessage(ChatUtils.adventureToMojang(supplier.get()));
} else {
internal.sendSuccess(() -> ChatUtils.adventureToMojang(supplier.get()), bl);
}
}
public void sendMessage(Component text) {
internal.sendSystemMessage(ChatUtils.adventureToMojang(text));
}
public void sendFailure(Component text) {