Development Assistance YamlConfiguration

Discussion in 'Plugin Help/Development/Requests' started by DaveLillo, Mar 23, 2015.

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


    How is the new way to use YamlConfiguration.loadConfigurafion(file)? Its depraced

  2. @DaveLillo
    Deprecated does not matter. Just use it anyway.
  3. Offline


    My Server only runs on 1.8. If i use it, it gives me an error in the console...
  4. Offline


    what is the error? also deprecated doesn't mean that it will always throw a error but more that there is a better way to use it
  5. Offline



    15:37:30 INFO]: [OnlineSigns] Enabling OnlineSigns v1.0
    [15:37:30 ERROR]: Error occurred while enabling OnlineSigns v1.0 (Is it up to date?)
    java.lang.IllegalArgumentException: Stream cannot be null
    at org.apache.commons.lang.Validate.notNull( ~[spigot.jar:git-Spigot-952179b-f98775c]
    at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration( ~[spigot.jar:git-Spigot-952179b-f98775c]
    at me.DaveLillo.OnlineSigns.Main.onEnable( ~[?:?]
    at ~[spigot.jar:git-Spigot-952179b-f98775c]
    at [spigot.jar:git-Spigot-952179b-f98775c]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin( [spigot.jar:git-Spigot-952179b-f98775c]
    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugin( [spigot.jar:git-Spigot-952179b-f98775c]
    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.enablePlugins( [spigot.jar:git-Spigot-952179b-f98775c]
    at net.minecraft.server.v1_8_R1.MinecraftServer.q( [spigot.jar:git-Spigot-952179b-f98775c]
    at net.minecraft.server.v1_8_R1.MinecraftServer.k( [spigot.jar:git-Spigot-952179b-f98775c]
    at net.minecraft.server.v1_8_R1.MinecraftServer.a( [spigot.jar:git-Spigot-952179b-f98775c]
    at net.minecraft.server.v1_8_R1.DedicatedServer.init( [spigot.jar:git-Spigot-952179b-f98775c]
    at [spigot.jar:git-Spigot-952179b-f98775c]
    at Source) [?:1.7.0_07]
    An in Line 24 is:

    YamlConfigurarion fc = YamlConfiguration.loadConfiguration(this.getResource("onlinesigns.yml"));
  6. Offline


  7. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives
  8. Offline


    This is my code:

    public void onEnable() {
            if(!file.exists()) { //Check if your external file exists
                try {
                    file.createNewFile(); //if not so, create a new one
          ; //save the configuration of config1 or config2 to your new file
                } catch (IOException e) {
                    System.out.println("[PluginName] couldn't create some files!"); //if something goes wrong this is what will be done then
                YamlConfiguration config2 = YamlConfiguration.loadConfiguration(this.getResource("signs.yml"));
    So the file should be created, right?

    But it isn't there...
  9. Offline


    @DaveLillo I'd go with file is null, show your full code.

    Also use getLogger().info("Random message"); it will automagically be prefixed with the plugin name.
  10. Offline


Thread Status:
Not open for further replies.

Share This Page