[NOJANG] Allow commands to send feedback as chat messages, if command feedback is disabled
This commit is contained in:
@@ -8,14 +8,24 @@ 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) {
|
||||
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) {
|
||||
internal.sendFailure(ChatUtils.adventureToMojang(text));
|
||||
|
@@ -1,4 +1,7 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fix Adventure Serializer failing completely when serialization fails, causing game glitches
|
||||
-
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Allow commands to send feedback as chat messages, if command feedback is disabled
|
Reference in New Issue
Block a user