minecraft-src/net/minecraft/server/commands/StopCommand.java
2025-07-04 01:41:11 +03:00

16 lines
660 B
Java

package net.minecraft.server.commands;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
public class StopCommand {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
dispatcher.register(Commands.literal("stop").requires(commandSourceStack -> commandSourceStack.hasPermission(4)).executes(commandContext -> {
commandContext.getSource().sendSuccess(() -> Component.translatable("commands.stop.stopping"), true);
commandContext.getSource().getServer().halt(false);
return 1;
}));
}
}