Reputation: 4544
So I wanted to create a GUI for a server to make stuff easier for ppl. I created a Gui with buttons for easy use so you don't have to enter commands all the time. The button works but I didn't find any function that executes a command as the player itself. I googled around but didn't find a solution for this problem.
(btw. this obviously didn't work: player.sendChatToPlayer("/{any command}");
(player is a EntityPlayer))
Regards Jens
Upvotes: 4
Views: 11400
Reputation: 1172
In case you want to execute a client-side only command, you can use
ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/your command");
Upvotes: 4
Reputation: 1714
Do a Minecraft.getMinecraft().thePlayer.sendChatMessage("/Command here")
Upvotes: 4