I am trying to create a command with CommandDispatcher
however it cannot resolve ‘game’ and ‘plugin’. I am aware that there have been some changes to the SpongeAPI though I do wish to not scan through Github as it will take some time.
I have capitalized the portion producing the error for clarity thus the capitalization for ‘game’ and ‘plugin’ do not reflect the actual code.
Other Info:
Sponge 2.1 Snapshot
Intellij IDEA Community Edition 15.0.2
Code Snippet:
public class HelloWorldCommand implements CommandExecutor {
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
src.sendMessage(Texts.of(“Hello, world!”));
return CommandResult.success();
}
}
public void onServerInitialization(GameInitializationEvent event) {
// Global event handlers and command registration are handled here and the plugin should be functional
CommandSpec myCommandSpec = CommandSpec.builder()
.description(Texts.of("Hello,world!"))
.permission("myplugin.command.helloworld")
.executor(new HelloWorldCommand())
.build();
GAME.getCommandDispatcher().register(PLUGIN, myCommandSpec, "helloworld", "hello", "test");
}