Posted October 20, 201213 yr hi guys so i am trying to find the place where to get the instance of ServerCommandManager, for what i have come up with, its from the FMLServerHandler.instance().getServer().getCommandManager() But my problem is, that when i try to use it, i get some problems. @ServerStarted and @ServerStarting dosnt seem to work fir the internal server. and as the sever is not initated yet in @Init, i kinda am confused where to register my custom commands. i am wondering if anyone had figured this out yet, as all the current google results, predates Forge 4.x and gives me guides for Forge 3 instead:/ thanks
October 21, 201213 yr ServerStarted should work just fine fort the internal server, and thats where you're supposed to register your commands, so, figure out why your event isnt working. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
October 21, 201213 yr Author yeah, i kinda screwed it up, i forgot to add the right paremeters to the methode it should be this @ServerStarting public void serverstart(FMLServerStartingEvent event){ ServerCommandManager scm = (ServerCommandManager)event.getServer().getCommandManager(); logger.info("Adding Commands"); scm.registerCommand(new CommandTest()); } i did the big mistake and wrote @ServerStarting public void serverstart(){ ServerCommandManager scm = (ServerCommandManager)FMLServerHandler.instance().getServer().getCommandManager(); logger.info("Adding Commands"); scm.registerCommand(new CommandTest()); }
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.