How I save a Custom FileConfinguration without File Name?

Discussion in 'Plugin Development' started by Batman500, Jun 3, 2016.

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

    Batman500

    How I save a Custom FileConfinguration without a File Name or How I get a File Name From a Custom FileConfinguration?

    Example:
    Code:
    FileConfinguration configCustom = YamlConfinguration.load(new File(getDataFolder(), "configCustom.yml"););
    
    configCustom.save(new File(getDataFolder(), configCustom.getFileName()));//I want save automaticaly, without need a FileName
    
     
    Last edited: Jun 3, 2016
  2. Offline

    I Al Istannen

    @Batman500
    Could you rephrase that? It is hard to understand what you want.
    How would you save a FileConfiguration without a File? Where do you save it to? So that is obviously not going to work.

    What do you want to do?
     
  3. Offline

    Batman500

  4. Offline

    Xerox262

    @Batman500 But it's called configCustom.yml that's your file name.
     
  5. Offline

    I Al Istannen

    @Batman500
    Adding to what @Xerox262 said.
    Why do you want to do this? Where should the config be saved. In computers every file has a Path assigned to it, to find it's location. If you don't provide one, you can't create a file. Simple as that.
    There might be a better way to do what you said though, but in order to think of one, I must know what you want to achieve with the new config.
     
  6. Offline

    Batman500

    @I Al Istannen I just wanted to know if bukkit has a form more fast as saveConfig();
     
  7. Offline

    I Al Istannen

    @Batman500
    saveDefaultConfig() and saveConfig() are just for the default config.yml. Which will be saved as config.yml (so the filename is also given). There is no other shortcut. You need to specify the name for every other configuration you use.
     
    Batman500 likes this.
Thread Status:
Not open for further replies.

Share This Page