diff --git a/Common/src/main/java/com/hypherionmc/craterlib/nojang/commands/BridgedCommandSourceStack.java b/Common/src/main/java/com/hypherionmc/craterlib/nojang/commands/BridgedCommandSourceStack.java index d10b151..9cdcb33 100644 --- a/Common/src/main/java/com/hypherionmc/craterlib/nojang/commands/BridgedCommandSourceStack.java +++ b/Common/src/main/java/com/hypherionmc/craterlib/nojang/commands/BridgedCommandSourceStack.java @@ -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 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) { diff --git a/changelog.md b/changelog.md index 43dd535..57b7ad6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ **Bug Fixes**: - Fix Adventure Serializer failing completely when serialization fails, causing game glitches -- \ No newline at end of file + +**New Features**: + +- Allow commands to send feedback as chat messages, if command feedback is disabled \ No newline at end of file