Reset Custom Config (Different YML File)

Discussion in 'Plugin Development' started by RastaLulz, Oct 7, 2012.

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

    RastaLulz

    Hello,

    I'm creating a little game, and at the end of each round a new map is needed. Each map has its info saved to an individual YML file in a specific folder. This means that after a game has ended, the info from "Map2.yml" will have to replace "Map1.yml" on "MapConfig".

    Here's what I'm doing at the moment.

    Code:
    public class SomePlugin extends JavaPlugin {
     
        private static FileConfiguration MapConfig;
     
        public void loadMap(Integer world) {
     
            File MapFile = new File(getDataFolder(), "maps/" + world + ".yml");
     
            MapConfig = YamlConfiguration.loadConfiguration(MapFile);
     
        }
     
    }
    The first time time I do that, it works fine. However, the next time around it doesn't work so well, as the file config info is already set to "MapConfig".

    How would I be able to set the new config file to "MapConfig"?
     
  2. Offline

    KeybordPiano459

Thread Status:
Not open for further replies.

Share This Page