Solved SaveDefaultConfig() error...

Discussion in 'Plugin Development' started by EcMiner, Aug 19, 2013.

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

    EcMiner

    Hello, i get a weird error when using the saveDefaultConfig(); method, here are all the resources, and YES i did make a new config.yml in my project like it should be:

    Main class
    Code:java
    1. package me.ecminer.tp;
    2.  
    3. import org.bukkit.event.Listener;
    4. import org.bukkit.plugin.java.JavaPlugin;
    5.  
    6. public class Main extends JavaPlugin implements Listener {
    7.  
    8. public void onEnable() {
    9. getServer().getPluginManager().registerEvents(this, this);
    10. saveDefaultConfig();
    11. }
    12.  
    13. public void onDisable() {
    14. }
    15.  
    16.  
    17. }
    18.  


    config.yml
    Code:
    why: isnt
    this: working
    Error:
    Code:php
    1. 19:21:23 [INFO] [TestPlugin] Enabling TestPlugin v1
    2. 19:21:23 [SEVERE] Error occurred while enabling TestPlugin v1 (Is it up to date?
    3. )
    4. java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be
    5. found in plugins\TestPlugin.jar
    6. at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:149)
    7. at org.bukkit.plugin.java.JavaPlugin.saveDefaultConfig(JavaPlugin.java:137)
    8. at me.ecminer.tp.Main.onEnable(Main.java:10)
    9. at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
    10. at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
    11. at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
    12. at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugin(CraftServer.java:282)
    13. at org.bukkit.craftbukkit.v1_6_R2.CraftServer.enablePlugins(CraftServer.java:264)
    14. at org.bukkit.craftbukkit.v1_6_R2.CraftServer.reload(CraftServer.java:605)
    15. at org.bukkit.Bukkit.reload(Bukkit.java:275)
    16. at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23)
    17. at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
    18. at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:523)
    19. at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchServerCommand(CraftServer.java:512)
    20. at net.minecraft.server.v1_6_R2.DedicatedServer.ar(DedicatedServer.java:262)
    21. at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:227)
    22. at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486)
    23. at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419)
    24. at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)


    Can anoybody help me?
     
  2. Change
    Code:
    saveConfig();
    into
    Code:
    getConfig().options().copyDefaults(true);
    saveConfig();
     
  3. Offline

    EcMiner

    Doesn't work
     
  4. well, where did you put the config.yml? Did you place it 'next to' your plugin.yml?
     
  5. Offline

    EcMiner

    I solved, Eclipse just didn't export the config.yml even though i said he should copy it


    I'm not a newbie i know how to do it right

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  6. EcMiner
    How could I know that you aren't a newbie?
     
  7. Offline

    EcMiner

    Im sorry, you couldn't knoe that, you were just trying to help, thanks you anyway
     
Thread Status:
Not open for further replies.

Share This Page