TellRawCommand .java

net.minecraft.server.commands.TellRawCommand (class, 29 lines): members: register. strings: "tellraw", "targets". imports: ComponentArgument, Commands.

net.minecraft.server.commandsclass29 linesserver1.0 KB

API Surface (1)

void register(final CommandDispatcher<CommandSourceStack> dispatcher, final CommandBuildContext context)

String literals (2)

"tellraw"
"targets"

Code Graph: Dependencies (6)

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

Full Source

TellRawCommand.java29 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.server.commands;
2
3
import com.mojang.brigadier.CommandDispatcher;
4
import net.minecraft.commands.CommandBuildContext;
5
import net.minecraft.commands.CommandSourceStack;
6
import net.minecraft.commands.Commands;
7
import net.minecraft.commands.arguments.ComponentArgument;
8
import net.minecraft.commands.arguments.EntityArgument;
9
import net.minecraft.server.level.ServerPlayer;
10
11
public class TellRawCommand {
12
	public static void register(final CommandDispatcher<CommandSourceStack> dispatcher, final CommandBuildContext context) {
13
		dispatcher.register(
14
			Commands.literal("tellraw")
15
				.requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS))
16
				.then(Commands.argument("targets", EntityArgument.players()).then(Commands.argument("message", ComponentArgument.textComponent(context)).executes(c -> {
17
					int result = 0;
18
19
					for (ServerPlayer player : EntityArgument.getPlayers(c, "targets")) {
20
						player.sendSystemMessage(ComponentArgument.getResolvedComponent(c, "message", player));
21
						result++;
22
					}
23
24
					return result;
25
				})))
26
		);
27
	}
28
}
29

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