How can I force player to type message on chat or execute command on chat?

How can I force player to type message on chat or execute command on chat ? on Sponge 8.0

e.g. force player type message and enter: “Hello Minecraft!”

or force player type command on chat and run: “WowW!” without use Sponge.cmd.process()

Please help me ?

To send a message as a player. You can do

ServerPlayer player;
Component message;
MessageType messgeType;
Sponge.server().sendMessage(player, message, messageType);

As for the command. Im assuming this is to do with the nucleus issue we talked about before.

When I said hacky, this isnt what I had in mind, but it can be done. Essentially the minecraft server will have a packet class for sending a command as a client. If you create a new instance of that, however make the receiver localhost. It will make it look like the server received a command from the player …

Although personally I would either ignore nucleus commands with your code and/or detect that nucleus commands are being ran and have a override to your command dispatcher to hook into nucleus api and manually run that code. Its not getting updated anymore so you know the nucleus api will never change

1 Like

Thank for you care!