Solved [1.8.8] Issues in config.yml

Discussion in 'Spigot Plugin Help' started by Glioh, Jun 16, 2021.

  1. Hello, I'm new to java/developing in general and I have a question regarding my config.yml. I'm following a guide and I can't seem to find out what's wrong in my plugin. Sorry if I presented my thread incorrectly, it's my first post. Here is the error I'm receiving -

    Code (Java):

    package com.glioh.plugin;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;

    import net.md_5.bungee.api.ChatColor;

    public class Main extends JavaPlugin implements Listener {

        public void onEnable() {
            System.out.println("[Placate] The plugin has been enabled!");
        public void onDisable() {
            System.out.println("[Placate] The plugin has been disabled!");
            public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
                if (cmd.getName().equals("config") ) {
                    String word = this.getConfig().getString("Word");
                    int number = this.getConfig().getInt("Number");
                    Player player = (Player) sender;
                    player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "The word is " + ChatColor.GREEN + word + " and the number is " + number);
                return false;
    Code (Java):

    Word: 'Melon'
    Number: 12
  2. Try rename the Number with something else.
  3. Did you write it exactly like that? If you put Number:12 it doesn't work. You need to write Number: 12.
    It should be a "blanck space" into Number: and 12
  4. And you should look if the spaces are ok. In YAML is very important the spaces you write.
    Make sure it is correct.
    Code (Text):
    world: 'Melon'
    number: 12
  5. Yes sir that's the exact code I wrote.
  6. Can you send a picture of your config.yml?
  7. I put the code in a YAML checker and everything seemed to work out fine.

    Attached Files:

    • s12.PNG
      File size:
      8.1 KB
  9. Why are you doing this? this.getConfig().options();
  10. Try to use a different key name. And i recommend u to start them in lowcase
  11. Oh, changing the keywords seemed to fix the problem. Thanks!
  12. I literally said that, lol.