-
Notifications
You must be signed in to change notification settings - Fork 30
Commands helper #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commands helper #269
Conversation
WaitingIdly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be for documentation only (yippee), but doing something like commands.registerCommand('help') { server, sender, args -> sender.sendMessage('You cannot be helped') }
lets you override commands - and, depending on when things are loaded, might make your custom commands be overridden by preexisting ones.
| } | ||
|
|
||
| public void registerClientCommand(ICommand command) { | ||
| if (FMLCommonHandler.instance().getSide().isServer()) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this print a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This way you can just register a command without having to make sure it doent run on server
| private boolean serverStarted = false; | ||
|
|
||
| public void registerCommand(ICommand command) { | ||
| if (GroovyScript.getSandbox().isRunning() && GroovyScript.getSandbox().getCurrentLoader().isReloadable()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like this code being required for Commands to work in preInit (if im reading what the reason is correctly) might indicate a deeper issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? I just dont want commands to reload when not registered durin postInit. I dont see any issue
commandsvariable which has helper methods to register client and server commandspostInitthey can be reloadedcustom/vanilla.groovy