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

21 lines
974 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.commands.arguments.MessageArgument;
import net.minecraft.network.chat.ChatType;
import net.minecraft.server.players.PlayerList;
public class EmoteCommands {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
dispatcher.register(Commands.literal("me").then(Commands.argument("action", MessageArgument.message()).executes(commandContext -> {
MessageArgument.resolveChatMessage(commandContext, "action", playerChatMessage -> {
CommandSourceStack commandSourceStack = commandContext.getSource();
PlayerList playerList = commandSourceStack.getServer().getPlayerList();
playerList.broadcastChatMessage(playerChatMessage, commandSourceStack, ChatType.bind(ChatType.EMOTE_COMMAND, commandSourceStack));
});
return 1;
})));
}
}