Java plugin

Off topicProgramming → Java plugin

Im creating a plugin for another server. its a /website plugin really simple but its not working here is the code

Main.java

this is the plugin.yml

plugin.yml

thanks in advanced

Add the @Override annotation above onCommand

In your plugin.yml you are referencing a lowercase “main” while your class is actually named “Main” with an uppercase M.

Also the missing annotation as nash has pointed out already.

Additionally, why are you casting the sender to player? You don’t access any player specific methods - what you’re doing just makes it crash when someone runs the command from console.

Just for the record, I haven’t written a full on plugin in quite a while, I barily remember how to do any of it. The point is that I found the annotation issue after < a min of googling. Which means if your spent even 5 mins looking, you could of at least found one of your problems. So please do a quick Google search before you ask questions.
Nash, the problem you found doesn’t even occur because he nevr gets that far. The plugin will simply not be loaded at all :P
And? If he had googled it, he would at least know to put it there. Meaning if he did search it up, it would be in code, as every link and example I saw, showed it, and mentioned it.
Actually, @Override is completely optional and won’t cause issues if you leave it out. It can make compilation slightly faster if you do use it, though.
Thanks for the responses and bit of arguing. IS there a need to register the command in on enable or does the if(cL.equalsIgnoreCase("website")) enough? also this may sound stupid but I heard there always needs to be an else statement if there is and if statement is that the case with if(cL.equalsIgnoreCase("website")) good

This is definitely not necroposting.

I wouldn’t use the command label, just use cmd.getName().equals(“website”). Note that cmd.getName() gives the name of the command, not what the user typed, so this will also work fine with aliases.