Solved Generating sections in my custom.yml creates errors in the server console

Discussion in 'Plugin Development' started by TFMM, Jul 28, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    TFMM

    I am new to programing plugins and got an error. Yes i know that it would be better update and not program on the 1.8 version.

    Code:
    [16:44:53] [Server thread/INFO]: Starting minecraft server version 1.8.8
    [16:44:53] [Server thread/INFO]: Loading properties
    [16:44:53] [Server thread/INFO]: Default game type: SURVIVAL
    [16:44:53] [Server thread/INFO]: Generating keypair
    [16:44:53] [Server thread/INFO]: Starting Minecraft server on *:25565
    [16:44:53] [Server thread/INFO]: Using default channel type
    [16:44:53] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-18fbb24 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
    [16:44:53] [Server thread/INFO]: [CraftFactory] Loading CraftFactory v1.0
    [16:44:53] [Server thread/INFO]: Preparing level "world"
    [16:44:53] [Server thread/INFO]: Preparing start region for level 0 (Seed: -3034974774624799760)
    [16:44:54] [Server thread/INFO]: Preparing start region for level 1 (Seed: -3034974774624799760)
    [16:44:55] [Server thread/INFO]: Preparing start region for level 2 (Seed: -3034974774624799760)
    [16:44:55] [Server thread/INFO]: [CraftFactory] Enabling CraftFactory v1.0
    [16:44:55] [Server thread/WARN]: org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.
    [16:44:55] [Server thread/WARN]:     at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:59)
    [16:44:55] [Server thread/WARN]:     at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:226)
    [16:44:55] [Server thread/WARN]:     at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:169)
    [16:44:55] [Server thread/WARN]:     at CraftFactory.CF_Main.loadYamls(CF_Main.java:85)
    [16:44:55] [Server thread/WARN]:     at CraftFactory.CF_Main.onEnable(CF_Main.java:34)
    [16:44:55] [Server thread/WARN]:     at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321)
    [16:44:55] [Server thread/WARN]:     at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332)
    [16:44:55] [Server thread/WARN]:     at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404)
    [16:44:55] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342)
    [16:44:55] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314)
    [16:44:55] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406)
    [16:44:55] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370)
    [16:44:55] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325)
    [16:44:55] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235)
    [16:44:55] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504)
    [16:44:55] [Server thread/WARN]:     at java.lang.Thread.run(Unknown Source)
    [16:44:55] [Server thread/ERROR]: Error occurred while enabling CraftFactory v1.0 (Is it up to date?)
    java.lang.NullPointerException
        at CraftFactory.CF_Main.registerCommands(CF_Main.java:53) ~[?:?]
        at CraftFactory.CF_Main.onEnable(CF_Main.java:36) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[craftbukkit.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [craftbukkit.jar:git-Bukkit-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342) [craftbukkit.jar:git-Bukkit-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314) [craftbukkit.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406) [craftbukkit.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370) [craftbukkit.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325) [craftbukkit.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235) [craftbukkit.jar:git-Bukkit-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504) [craftbukkit.jar:git-Bukkit-18fbb24]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_141]
    [16:44:55] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [16:44:55] [Server thread/INFO]: Done (1,580s)! For help, type "help" or "?"
    and here is the code of the Main.

    Code:
    package CraftFactory;
    
    import java.io.File;
    import java.io.IOException;
    import java.util.logging.Logger;
    
    import org.bukkit.configuration.InvalidConfigurationException;
    import org.bukkit.configuration.file.YamlConfiguration;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import CraftFactory.commands.companyadd;
    import CraftFactory.event.block.BlockBreak;
    import CraftFactory.event.player.PlayerChat;
    import CraftFactory.event.player.PlayerJoin;
    
    public class CF_Main extends JavaPlugin {
        public static CF_Main plugin;
        private File l = null;
        private File f = null;
        private YamlConfiguration lang = new YamlConfiguration();
        private YamlConfiguration factories = new YamlConfiguration();
      
        public void onEnable() {
            PluginDescriptionFile pdfFile = getDescription();
            Logger logger = Logger.getLogger("Minecraft");
            plugin = this;
            l = new File(getDataFolder(), "lang.yml");
            f = new File(getDataFolder(), "factories.yml");
            mkdir();
            loadYamls();
    
            registerCommands();
            registerEvents();
            registerConfig();
          
            logger.info(pdfFile.getName() + " has been enable (V." + pdfFile.getVersion() + ")");
        }
        public void onDisable() {
            PluginDescriptionFile pdfFile = getDescription();
            Logger logger = Logger.getLogger("Minecraft");
            logger.info(pdfFile.getName() + " has been disabled (V." + pdfFile.getVersion() + ")");
        }
        public void registerCommands() {
            getCommand("addcompany").setExecutor(new companyadd());
        }
        public void registerEvents() {
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvents(new BlockBreak(), this);
            pm.registerEvents(new PlayerChat(), this);
            pm.registerEvents(new PlayerJoin(this), this);
        }
        private void registerConfig() {
            getConfig().options().copyDefaults(true);
            saveConfig();  
        }
        private void mkdir() {
            if(!l.exists()) {
                saveResource("lang.yml", false);
            }
            if(!f.exists()) {
                saveResource("factories.yml", false);
            }
        }
        private void loadYamls() {
                try {
                    lang.load(l);
                } catch (IOException | InvalidConfigurationException e1) {
                    e1.printStackTrace();
                }
                try {
                    factories.load(f);
                } catch (IOException | InvalidConfigurationException e) {
                    e.printStackTrace();
                }
        }
        public YamlConfiguration getLang() {
            return lang;
        }
        public YamlConfiguration getFactories() {
            return factories;
        }
        public void saveLang() {
            try {
                lang.save(l);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        public void saveFactories() {
                try {
                    lang.save(f);
                } catch (IOException e) {
                    e.printStackTrace();
                }
        }
    }
    
    the code for the sections and the command

    Code:
    package CraftFactory.commands;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    import CraftFactory.CF_Main;
    
    public class companyadd implements CommandExecutor{
    
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if(!(sender instanceof Player)) {
                sender.sendMessage("You must be a player to use this command!");
            return false;
            }
            if(!(cmd.getName().equalsIgnoreCase("cf")))
                {
                return false;
                }
            else
                {
                    if(args[0].equalsIgnoreCase("addcompany"));
                    {
                        String companyname = args[1];
                    CF_Main.plugin.getFactories().getConfigurationSection("Companies").createSection(companyname);
                    CF_Main.plugin.saveFactories();
                    return true;
                    }
                  
                }
          
        }
    }
    
    

    my custom config

    Code:
    Companies:
    
    and how i want my custom config to be

    Code:
    Companies:
      name of the company:
        owner: [player]
    
    a user types the command "/cf addcompany [name of the company]" which creates sections like above for the data.

    Thx for any help.
     
    Last edited by a moderator: Jul 28, 2017
  2. Offline

    Machine Maker

    @TFMM
    1. You cannot have a config start out with just Companies:.

    2. The configuration is a map of pairs which each have a key and a value. You just have a key so it is not recognizing that the file is supposed to be a configuration file. If you want Companies to be blank, add {} after it in the config.
     
  3. Offline

    TFMM

    still doesn't work :/
     
  4. Offline

    Zombie_Striker

    Then why do it? If you know there is no reason to stay on 1.8, why are you?

    Don't steal minecraft's logger! If you need to log something (which you don't) use getLogger() instead

    Again, you do not need to log your own plugins. Bukkit logs them automatically for you. Remove the loggers in the onEnable, and the entire onDisable.

    Do not abuse static. You should never have to use the static modifier when writing plugins. If you need other classes to get this class's instance, pass this class's instance through the other class's constructor.

    What "does not work"? What changes have you made? Post the updated code.
     
    TFMM likes this.
  5. Offline

    Machine Maker

    @TFMM
    What is on line 85?
     
  6. Offline

    TFMM

    I got a 1.8 server because i don't like the tool cooldown in the new minecraft versions.

    I want to start the plugin without errors in my serverlog.


    Main

    Code:
    package CraftFactory;
    
    import java.io.File;
    import java.io.IOException;
    
    import org.bukkit.configuration.InvalidConfigurationException;
    import org.bukkit.configuration.file.YamlConfiguration;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import CraftFactory.commands.companyadd;
    import CraftFactory.event.block.BlockBreak;
    import CraftFactory.event.player.PlayerChat;
    import CraftFactory.event.player.PlayerJoin;
    
    public class CF_Main extends JavaPlugin {
        public CF_Main plugin;
        private File l = null;
        private File f = null;
        private YamlConfiguration lang = new YamlConfiguration();
        private YamlConfiguration factories = new YamlConfiguration();
     
        public void onEnable() {
            plugin = this;
            l = new File(getDataFolder(), "lang.yml");
            f = new File(getDataFolder(), "factories.yml");
            mkdir();
            loadYamls();
    
            registerCommands();
            registerEvents();
            registerConfig();
         
        }
        public void onDisable() {
        }
        public void registerCommands() {
            getCommand("addcompany").setExecutor(new companyadd());
        }
        public void registerEvents() {
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvents(new BlockBreak(), this);
            pm.registerEvents(new PlayerChat(), this);
            pm.registerEvents(new PlayerJoin(this), this);
        }
        private void registerConfig() {
            getConfig().options().copyDefaults(true);
            saveConfig(); 
        }
        private void mkdir() {
            if(!l.exists()) {
                saveResource("lang.yml", false);
            }
            if(!f.exists()) {
                saveResource("factories.yml", false);
            }
        }
        private void loadYamls() {
                try {
                    lang.load(l);
                } catch (IOException | InvalidConfigurationException e1) {
                    e1.printStackTrace();
                }
                try {
                    factories.load(f);
                } catch (IOException | InvalidConfigurationException e) {
                    e.printStackTrace();
                }
        }
        public YamlConfiguration getLang() {
            return lang;
        }
        public YamlConfiguration getFactories() {
            return factories;
        }
        public void saveLang() {
            try {
                lang.save(l);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        public void saveFactories() {
                try {
                    lang.save(f);
                } catch (IOException e) {
                    e.printStackTrace();
                }
        }
    }
    
    
    custom yml section generation and command

    Code:
    package CraftFactory.commands;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    import CraftFactory.CF_Main;
    
    public class companyadd implements CommandExecutor{
    
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if(!(sender instanceof Player)) {
                sender.sendMessage("You must be a player to use this command!");
            return false;
            }
            //Player player = (Player) sender;
            if(!(cmd.getName().equalsIgnoreCase("cf")))
                {
                return false;
                }
            else
                {
                    if(args[0].equalsIgnoreCase("addcompany"));
                    {
                        String companyname = args[1];
                    CF_Main.plugin.getFactories().getConfigurationSection("Companies").createSection(companyname);
                    CF_Main.plugin.saveFactories();
                    return true;
                    }
                 
                }
         
        }
    }
    
    
    i deleted the static and the logger stuff. Now in this code "CF_Main.plugin.getFactories().getConfigurationSection("Companies").createSection(companyname);" the "Main.plugin" says that "plugin" needs to be static
     
  7. Offline

    timtower Administrator Administrator Moderator

    @TFMM No, you need a constructor to pass the main instance along instead of the static reference that you are using now.
     
  8. Offline

    TFMM

    and how?
     
  9. Offline

    timtower Administrator Administrator Moderator

  10. Offline

    Zombie_Striker

    As posted in the thread I linked, <Edit by Moderator: Redacted not allowed paid resource url> reverts the pvp back to pre1.9 and removes cooldown effects.

    Can you post the error logs?

    https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html
     
    Last edited by a moderator: Feb 10, 2021
  11. Offline

    TFMM

    Code:
    [16:44:53] [Server thread/INFO]: Starting minecraft server version 1.8.8
    [16:44:53] [Server thread/INFO]: Loading properties
    [16:44:53] [Server thread/INFO]: Default game type: SURVIVAL
    [16:44:53] [Server thread/INFO]: Generating keypair
    [16:44:53] [Server thread/INFO]: Starting Minecraft server on *:25565
    [16:44:53] [Server thread/INFO]: Using default channel type
    [16:44:53] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-18fbb24 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
    [16:44:53] [Server thread/INFO]: [CraftFactory] Loading CraftFactory v1.0
    [16:44:53] [Server thread/INFO]: Preparing level "world"
    [16:44:53] [Server thread/INFO]: Preparing start region for level 0 (Seed: -3034974774624799760)
    [16:44:54] [Server thread/INFO]: Preparing start region for level 1 (Seed: -3034974774624799760)
    [16:44:55] [Server thread/INFO]: Preparing start region for level 2 (Seed: -3034974774624799760)
    [16:44:55] [Server thread/INFO]: [CraftFactory] Enabling CraftFactory v1.0
    [16:44:55] [Server thread/WARN]: org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.
    [16:44:55] [Server thread/WARN]: at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:59)
    [16:44:55] [Server thread/WARN]: at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:226)
    [16:44:55] [Server thread/WARN]: at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:169)
    [16:44:55] [Server thread/WARN]: at CraftFactory.CF_Main.loadYamls(CF_Main.java:85)
    [16:44:55] [Server thread/WARN]: at CraftFactory.CF_Main.onEnable(CF_Main.java:34)
    [16:44:55] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321)
    [16:44:55] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332)
    [16:44:55] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404)
    [16:44:55] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342)
    [16:44:55] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314)
    [16:44:55] [Server thread/WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406)
    [16:44:55] [Server thread/WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370)
    [16:44:55] [Server thread/WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325)
    [16:44:55] [Server thread/WARN]: at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235)
    [16:44:55] [Server thread/WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504)
    [16:44:55] [Server thread/WARN]: at java.lang.Thread.run(Unknown Source)
    [16:44:55] [Server thread/ERROR]: Error occurred while enabling CraftFactory v1.0 (Is it up to date?)
    java.lang.NullPointerException
    at CraftFactory.CF_Main.registerCommands(CF_Main.java:53) ~[?:?]
    at CraftFactory.CF_Main.onEnable(CF_Main.java:36) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[craftbukkit.jar:git-Bukkit-18fbb24]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [craftbukkit.jar:git-Bukkit-18fbb24]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit.jar:git-Bukkit-18fbb24]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342) [craftbukkit.jar:git-Bukkit-18fbb24]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314) [craftbukkit.jar:git-Bukkit-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406) [craftbukkit.jar:git-Bukkit-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370) [craftbukkit.jar:git-Bukkit-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325) [craftbukkit.jar:git-Bukkit-18fbb24]
    at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235) [craftbukkit.jar:git-Bukkit-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504) [craftbukkit.jar:git-Bukkit-18fbb24]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_141]
    [16:44:55] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [16:44:55] [Server thread/INFO]: Done (1,580s)! For help, type "help" or "?" 
     
  12. Offline

    timtower Administrator Administrator Moderator

    @TFMM The command that you are registering, is it also in your plugin.yml ?
     
  13. Offline

    TFMM

    yes

    Code:
    main: CraftFactory.CF_Main
    version: 1.0
    name: CraftFactory
    
    commands:
      cf:
        description: 

    Code:
    if(!(cmd.getName().equalsIgnoreCase("cf")))
                {
                return false;
                }
            else
                {
                    if(args[0].equalsIgnoreCase("addcompany"));
                    {
                        String companyname = args[1];
                    CF_Main.plugin.getFactories().getConfigurationSection("Companies").createSection(companyname);
                    CF_Main.plugin.saveFactories();
                    return true;
                    }
                 
                }
    it's only "cf" because i am checking the addcompany as args[0] in the onCommand method
     
  14. Offline

    timtower Administrator Administrator Moderator

    @TFMM
    Code:
    public void registerCommands() {
    getCommand("addcompany").setExecutor(new companyadd());
    }
    Needs to be cf then, not addcompany.
     
  15. Offline

    TFMM

    the error in the server log is still there "
    org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map."

    ok i replaced it

    still get this error

    Code:
    [22:03:04] [Server thread/INFO]: Starting minecraft server version 1.8.8
    [22:03:04] [Server thread/INFO]: Loading properties
    [22:03:04] [Server thread/INFO]: Default game type: SURVIVAL
    [22:03:04] [Server thread/INFO]: Generating keypair
    [22:03:05] [Server thread/INFO]: Starting Minecraft server on *:25565
    [22:03:05] [Server thread/INFO]: Using default channel type
    [22:03:05] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-18fbb24 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
    [22:03:05] [Server thread/INFO]: [CraftFactory] Loading CraftFactory v1.0
    [22:03:05] [Server thread/INFO]: Preparing level "world"
    [22:03:05] [Server thread/INFO]: Preparing start region for level 0 (Seed: -3034974774624799760)
    [22:03:06] [Server thread/INFO]: Preparing spawn area: 37%
    [22:03:06] [Server thread/INFO]: Preparing start region for level 1 (Seed: -3034974774624799760)
    [22:03:07] [Server thread/INFO]: Preparing spawn area: 82%
    [22:03:07] [Server thread/INFO]: Preparing start region for level 2 (Seed: -3034974774624799760)
    [22:03:08] [Server thread/INFO]: [CraftFactory] Enabling CraftFactory v1.0
    [22:03:08] [Server thread/WARN]: org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.
    [22:03:08] [Server thread/WARN]:     at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:59)
    [22:03:08] [Server thread/WARN]:     at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:226)
    [22:03:08] [Server thread/WARN]:     at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:169)
    [22:03:08] [Server thread/WARN]:     at CraftFactory.CF_Main.loadYamls(CF_Main.java:67)
    [22:03:08] [Server thread/WARN]:     at CraftFactory.CF_Main.onEnable(CF_Main.java:28)
    [22:03:08] [Server thread/WARN]:     at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321)
    [22:03:08] [Server thread/WARN]:     at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332)
    [22:03:08] [Server thread/WARN]:     at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404)
    [22:03:08] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342)
    [22:03:08] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314)
    [22:03:08] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406)
    [22:03:08] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370)
    [22:03:08] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325)
    [22:03:08] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235)
    [22:03:08] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504)
    [22:03:08] [Server thread/WARN]:     at java.lang.Thread.run(Unknown Source)
    [22:03:08] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [22:03:08] [Server thread/INFO]: Done (3,329s)! For help, type "help" or "?"
    
    
     
  16. Offline

    timtower Administrator Administrator Moderator

    @TFMM Please post your default config.
     
  17. Offline

    TFMM

    Code:
    # Plugin CraftFactory
    # Version 1.0
    
    Server Admins:
        - Yukiteru_Amano
        - Amando_Montero
        - GreenFireYT
    Welcome Message: '&4Hello and welcome to the Server %p'
     
  18. Offline

    Caderape2

    @TFMM The error come when you load one of your custom config. Show the config linked to the line 85, in the method loadYamls()
     
  19. Offline

    TFMM

    Code:
    private void loadYamls() {
                try {
                    lang.load(l);
                } catch (IOException | InvalidConfigurationException e1) {
                    e1.printStackTrace();
                }
                try {
                    factories.load(f);
                } catch (IOException | InvalidConfigurationException e) {
                    e.printStackTrace();
                }
        }
    my lang.yml is currently empty

    and factories config

    Code:
    Companies: {}
    My lang.yml comfig wasn't empty at line 91 was a string without : at the end

    the error is now gone.


    Now how can i create new sections in my custom config factories.yml like so

    Code:
    Companies: {}
      name of the company: {}
        owner: name of the player;
    the command /cf addcompany [name of the comapany] creates the sections
     
    Last edited: Jul 29, 2017
  20. Offline

    Machine Maker

    @TFMM
    1. You only need the {} if there is nothing below the key. Also, don't use spaces in "name of the company"

    2. To set that you have to do
    Code:
    plugin.getConfig().set("Companies.name_of_the_company.owner", playername);
    Use the periods to separate the paths.
     
    TFMM likes this.
  21. Offline

    TFMM

    ok

    the "name_of_the_company" isn't a name. its like a variable that uses the args[1] of the command after the addcompany
     
  22. Offline

    Machine Maker

    @TFMM
    oh ok. makes sense. All you really need to know then is that you use the "." to separate the keys.

    Please mark this thread as Solved if your issue has been resolved.
     
    TFMM likes this.
Thread Status:
Not open for further replies.

Share This Page