Novality Posted July 26, 2021 Posted July 26, 2021 I've looked far and wide across the internet for some sort of help, but I can't find any methods that allow me to send commands through console. Not much more needs to be said, this is quite a simple post. If someone could give me something, anything, that would be nice. Quote
poopoodice Posted July 26, 2021 Posted July 26, 2021 You can run servers and then execute commands there. Quote
Novality Posted July 26, 2021 Author Posted July 26, 2021 On 7/26/2021 at 7:06 AM, diesieben07 said: Some clarification is needed. Do you want to write a mod that executes a command as if it was entered in the server console? Do you want to write an external program that relays commands to the server console? Expand One that executes commands as if it was entered in the server console. Quote
Novality Posted July 26, 2021 Author Posted July 26, 2021 On 7/26/2021 at 6:49 AM, poopoodice said: You can run servers and then execute commands there. Expand That has nothing to do with what I asked? Quote
Novality Posted July 26, 2021 Author Posted July 26, 2021 On 7/26/2021 at 3:38 PM, diesieben07 said: MinecraftServer#getCommands().performCommand(source, command). command is the command you want to run, source is the CommandSource for it. To use the same one the console uses, use MinecraftServer#createCommandSourceStack. Expand Thanks, but I'm having an issue grabbing the MinecraftServer variable. My code: MinecraftServer source = MinecraftServer.getServer(); source.getCommands().performCommand(source.createCommandSourceStack(), "say hi"); It doesn't seem to recognize "getServer()" Quote
Novality Posted July 26, 2021 Author Posted July 26, 2021 NEVERMIND. I found something that works for me: MinecraftServer source = LogicalSidedProvider.INSTANCE.get(LogicalSide.SERVER); Topic SOLVED Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.