Files
PlazmaBukkitMC/plazma-server/minecraft-patches/sources/net/minecraft/server/commands/TickCommand.java.patch
2025-02-24 01:53:56 +09:00

25 lines
1.2 KiB
Diff

--- a/net/minecraft/server/commands/TickCommand.java
+++ b/net/minecraft/server/commands/TickCommand.java
@@ -21,6 +_,8 @@
dispatcher.register(
Commands.literal("tick")
.requires(commandSourceStack -> commandSourceStack.hasPermission(3))
+ .executes(context -> toggleFreeze(context.getSource()))
+ .then(Commands.literal("toggle").executes(context -> toggleFreeze(context.getSource())))
.then(Commands.literal("query").executes(commandContext -> tickQuery(commandContext.getSource())))
.then(
Commands.literal("rate")
@@ -113,6 +_,12 @@
source.sendSuccess(() -> Component.translatable("commands.tick.status.sprinting"), true);
return 1;
}
+
+ // Plazma start - /tick toggle
+ private static int toggleFreeze(final CommandSourceStack source) {
+ return setFreeze(source, !source.getServer().tickRateManager().isFrozen());
+ }
+ // Plazma end - /tick toggle
private static int setFreeze(CommandSourceStack source, boolean frozen) {
ServerTickRateManager serverTickRateManager = source.getServer().tickRateManager();