Solved Plugin.yml?

Discussion in 'Spigot Plugin Development' started by jamesd5, Jun 26, 2018.

  1. 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.
     
  2. 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.
     
    • Informative Informative x 1
  3. 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
     
  4. 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.
     
  5. 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'
     
  6. 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.
     
  7. DavidDevelops

    Supporter

    Not being rude at all glad you're starting :D 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/)
     
  8. OMG That was so easy(at least for me, might have been tough reexplaining it...) ty everyone for helping me :D