StopCommand .java

net.minecraft.server.commands.StopCommand (class, 17 lines): members: register. strings: "commands.stop.stopping", "stop". imports: CommandDispatcher.

net.minecraft.server.commandsclass17 linesserver615 B

API Surface (1)

void register(final CommandDispatcher<CommandSourceStack> dispatcher)

String literals (2)

"stop"
"commands.stop.stopping"

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

StopCommand.java17 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.server.commands;
2
3
import com.mojang.brigadier.CommandDispatcher;
4
import net.minecraft.commands.CommandSourceStack;
5
import net.minecraft.commands.Commands;
6
import net.minecraft.network.chat.Component;
7
8
public class StopCommand {
9
	public static void register(final CommandDispatcher<CommandSourceStack> dispatcher) {
10
		dispatcher.register(Commands.literal("stop").requires(Commands.hasPermission(Commands.LEVEL_OWNERS)).executes(c -> {
11
			c.getSource().sendSuccess(() -> Component.translatable("commands.stop.stopping"), true);
12
			c.getSource().getServer().halt(false);
13
			return 1;
14
		}));
15
	}
16
}
17

Decompiled Minecraft 26.3 source of StopCommand (net/minecraft/server/commands/StopCommand.java) with Mojang official mappings, stored verbatim on the site.