Discussion in 'Plugin Development' started by vhbob, Apr 5, 2015.
What do you mean syntax?
@vhbob He's telling you to put your code in [ code] [ /code] blocks.
Ive put my code in the code blocks
Do you have a plugin.yml?
You need a plugin.yml, your class to be implementing CommandExecutor and you also need to register the command both in the yml and plugin itself.
Like @Msrules123 said you need to create a plugin.yml in the project. Also why do you have the @Override tags in the onEnable() and onDisable() methods? They shouldn't be necessary. And finally, you don't want to have your onCommand boolean return false, that doesn't make sense.
The onEnable and onDisable do not need @Override
Logger is already added to the plugin.
You have a two returns, one of which is not needed.
You return false.
Now, that's not the reason your plugin isn't working, but it does tell me that you are new to Java and that you are probably using a Youtube Tutorial, which I highly suggest you not follow.
It can be a buildpath problem or a Plugin.yml error.
Show us the plugin.yml
@Zombie_Striker @Booshayy, if you ever program professionally, refusing to use @Override will get you fired. Don't even try to write inheritance without it.
@Tecno_Wizard Yes, however they're not saying its not needed ever. They are say it is not needed in this situation and he doesn't even have any code in his onDisable why would he need an @Override?
It's good practice really. It helps with readability when other developers look at your code. Also, you tell the compiler that you are really going to override a method from a superclass. If you misspelt the method name that you are trying to override (annotated by @Override) your IDE will throw an error, and save you from hours and hours of frustration overnight finding out why your plugin doesn't work only to see you spelt it onEnabel(). (This happened to me more or less. Now I go ape with @Override)
Now that's not going to happen here most of the time, but in the professional world of programming, that @Override is pretty important and useful.
Ironically, even though I agree with what you said and the fact that @Override is very imporant to use, it doesn't even compile...
@meguy26, no, it doesn't, but it will throw a compiler error if you make a mistake and save you a few hours of debugging.
@vhbob, Back to the question at hand. Can you give us more information about what happens when you try to load your plugin? The code you have posted here is fine, so it looks like the problem lies in your plugin YAML file, or lack thereof.
Separate names with a comma.