SayCommand .java

net.minecraft.server.commands.SayCommand (class, 26 lines): members: register. imports: MessageArgument, ChatType, PlayerList, CommandDispatcher, Commands.

net.minecraft.server.commandsclass26 linesserver963 B

API Surface (1)

void register(final CommandDispatcher<CommandSourceStack> dispatcher)

Code Graph: Dependencies (5)

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

Full Source

SayCommand.java26 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.commands.arguments.MessageArgument;
7
import net.minecraft.network.chat.ChatType;
8
import net.minecraft.server.players.PlayerList;
9
10
public class SayCommand {
11
	public static void register(final CommandDispatcher<CommandSourceStack> dispatcher) {
12
		dispatcher.register(
13
			Commands.literal("say")
14
				.requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS))
15
				.then(Commands.argument("message", MessageArgument.message()).executes(c -> {
16
					MessageArgument.resolveChatMessage(c, "message", message -> {
17
						CommandSourceStack source = c.getSource();
18
						PlayerList playerList = source.getServer().getPlayerList();
19
						playerList.broadcastChatMessage(message, source, ChatType.bind(ChatType.SAY_COMMAND, source));
20
					});
21
					return 1;
22
				}))
23
		);
24
	}
25
}
26

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