How do I send a command to the server like "/msg someone some important event happened!" using a fabric mod in Minecraft 1.20.1?
I haven't been able to find any code to try out that is not using classes that do not exist anymore.
The simplest way to do it is to use
new CommandDispatcher<S>().execute(commandString, source);
where commandString is the command which you want to execute(e.g. "/kill @e"
) and source is an object of type S
- for example if you are doing this from a command, you would do
new CommandDispatcher<CommandContext<ServerCommandSource>>.execute("/kill @e", myCommandContext)