where is the fail?

Discussion in 'Plugin Development' started by Kingzuck, Oct 18, 2011.

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

    Kingzuck

    Source:
    Code:
    package de.krank.falsecraft;
    
    import java.io.File;
    
    import org.bukkit.configuration.Configuration;
    
    public class Filemangaer {
    
        private static String ordner = "Plugins/FalseCraft" ;
        private static File ConfigFile = new File(ordner + File.separator +"config.yml");
        private static Configuration config;
     
        private Configuration loadconfig(){
     
            try{
    
                Configuration config = new Configuration(ConfigFile);
     
                return config;
            }catch(Exception e){
    
                e.printStackTrace();
                return null;
    
            }
     
        }
    
    }
    
    eclipe say Cannot instantiate the type Configuration by
    Code:
    Configuration config = new Configuration(ConfigFile);
    why?
     
  2. Offline

    Euphi_

    you already declared the variable
    private static Configuration config;


    try changing
    Configuration config = new Configuration(ConfigFile);



    to just
    config = new Configuration(ConfigFile);
     
  3. Offline

    thehutch

    What are you trying to do this is not how to use the new configuration API your trying to use the old API with the new one it wont work.
     
  4. Offline

    Bone008

    You must be trying to use the new "Configuration"-class like the old one - which won't work. The new class called Configuration is abstract (which gives you the error).
    The implementation you probably want to use is YamlConfiguration.

    Anyway, why don't you just use plugin.getConfig()?
     
  5. Offline

    Kingzuck

    Anywehre have a howto or tutorial for the new version for YML
     
  6. Offline

    thehutch

Thread Status:
Not open for further replies.

Share This Page