Hey I am starting one of my first ever plugins and I have no errors in the console and it loads fine, the commands just do nothing. My question is what am I do wrong. https://pastebin.com/Azkm7Da1 config.yml https://pastebin.com/ZcVMrLh4 Thank you
I don't know what you're doing there with your description in the plugin.yml, but don't do it. Also, you should register the command by the command name only, not with its arguments. In "frozenlemon help," help is an argument. Same goes for your command in the command executor. Check if the command's name is "frozenlemon", check if args.length is 1. If so, check if args[0] is "help". If so, do what you need to do.
It's an accepted YAML syntax, tells the parser that the value of the given key is specified on the newline. Seen it done plenty of times. It's not a config.yml, it's a plugin.yml. The poster above is correct, though. Use only the label (in your case, only "frozenlemon" in the plugin.yml. All subarguments will be handled by your onCommand method. Also, don't create a static instance of your plugin if you... never set it to anything. Your 'plugin' variable will be null because you never instantiate it in the onEnable. Here's a link to a resource I made that details, in part, the onCommand method.
Here, I am trying to understand and this is what I got... main https://pastebin.com/MYBnSzvV plugin.yml (oops my bad) https://pastebin.com/7a0mr2qQ
plugin.yml appears to be fine, the method name must be onCommand in the main class And you also didn't address the null instance of your plugin
If you still haven't fixed this, and that command will be the only command, remove where you are getting the command and just leave it to test for the permissions since there is no point to get the command if you only have 1 command that is defined through the plugin.yml.
Just fix your plugin.yml file: Code (YAML): main: me.jamesd5.MasterHealth.MasterHealth name: MasterHealth version: 1.0 description: > When downloading this plugin plays obtain the ability of setting their health and food bar size. commands: frozenlemon help: description: Gives all FrozenLemon commands. there is a problem with description and 'frozenlemon help' command, remove 'help', and use 'args' parametr in 'onCommand'
Ok. so from what I am hearing I got this... https://pastebin.com/TkQEmGV8 And Yes, I am doing more than one command but just need to know the base of one first. plugin.yml https://pastebin.com/T95innhe I feel the plugin.yml is correct but the main may have some issues, and I was given the answers I just don't know how un null the command. (take in mind I learn of youtube and just started a week ago) If there is a easy way to fix please show me and explain why this and that. It would be very helpful.
Not being rude at all glad you're starting But iid recommend basic java first if you haven't else wise to fix this its pretty simple, the reason "/frozenlemon help" won't work is because you're not checking if a arg you are onlying checking it its "/frozenlemon" so you will get the output as long as you put that, to check args would be something like this (Was going to show code but this may help a lot more! https://bukkit.org/threads/tutorial-command-arguments.186497/)
OMG That was so easy(at least for me, might have been tough reexplaining it...) ty everyone for helping me