	public ConfigManager(Plugin plugin) {
		this.plugin = plugin;
		FileConfiguration config = plugin.getConfig();
		config.options().copyDefaults(true);
		plugin.saveDefaultConfig();
		try {
			ConfigurationSection dreamSection = config.getConfigurationSection("dream");
			dreamWorldName = dreamSection.getString("world name");
			noAnimalSpawning = dreamSection.getBoolean("no animal spawning");
			noMonsterSpawning = dreamSection.getBoolean("no monster spawning");
			dreamChance = dreamSection.getInt("chance");
			minDurationSeconds = dreamSection.getInt("min duration in seconds");
			maxDurationSeconds = dreamSection.getInt("max duration in seconds");
			spawnRandomly = dreamSection.getBoolean("spawn randomly each time");
			dreamSpawns = SoftLocation.getFromStringList(dreamSection.getStringList("random spawns"));
			applyInitialGamemode = dreamSection.getBoolean("gamemode.apply");
			initialGamemode = GameMode.getByValue(dreamSection.getInt("gamemode.initial gamemode"));
			applyInitialHealth = dreamSection.getBoolean("health.apply");
			initialHealth = dreamSection.getInt("health.initial health");
			applyInitialHunger = dreamSection.getBoolean("hunger.apply");
			initialHunger = dreamSection.getInt("hunger.initial hunger");
			applyInitialPotionEffects = dreamSection.getBoolean("potion effects.apply");
			initialPotionEffects = new ArrayList<PotionEffect>();
			ConfigurationSection potionsSection = dreamSection.getConfigurationSection("potion effects.initial potion effects");
			if (potionsSection != null) {
				for (String type : potionsSection.getKeys(false)) {
					ConfigurationSection potionSection = potionsSection.getConfigurationSection(type);
					if (potionSection == null) continue;
					PotionEffectType potionType = PotionEffectType.getByName(type);
					if (potionType == null) {
						plugin.getLogger().warning("Invalid potion effect type '" + type + "'. Skipping this effect now. You can find a list of all possible PotionEffectTypes by googling 'bukkit PotionEffectType'.");
						continue;
					}
					initialPotionEffects.add(new PotionEffect(potionType, potionSection.getInt("duration"), potionSection.getInt("level", 1)));
				}
			}
			clearAndRestorePlayer = dreamSection.getBoolean("clear and restore player");
			purgeAfterMinutes = dreamSection.getInt("purge saved dream data after x minutes");
			ignoreIfRemainingTimeIsLowerThan = dreamSection.getInt("ignore if remaining seconds is lower than");
			ConfigurationSection fakeTimeSection = dreamSection.getConfigurationSection("fake client time");
			fakeTimeEnabled = fakeTimeSection.getBoolean("enabled") ;
			fakeTime = fakeTimeSection.getInt("time (in ticks)");
			fakeTimeRandomBounds = fakeTimeSection.getInt("random bounds");
			fakeTimeFixed = fakeTimeSection.getBoolean("fixed time");
			fakeRain = dreamSection.getBoolean("fake client weather.raining");
			ConfigurationSection disabledSection = dreamSection.getConfigurationSection("disabled");
			hungerDisabled = disabledSection.getBoolean("hunger");
			fallDamageDisabled = disabledSection.getBoolean("fall damage");
		    entityDamageDisabled = disabledSection.getBoolean("entity damage");
		    allDamageDisabled = disabledSection.getBoolean("all damage");
			weatherDisabled = disabledSection.getBoolean("weather");
			itemDroppingDisabled = disabledSection.getBoolean("item dropping");
			itemPickupDisabled = disabledSection.getBoolean("item pickup");
			blockPlacingDisabled = disabledSection.getBoolean("block placing");
			blockBreakingDisabled = disabledSection.getBoolean("block breaking");
			allowedCommands = dreamSection.getStringList("allowed commands");
			wasConfigValid = true;
		} catch (Exception e) {
			e.printStackTrace();
			wasConfigValid = false;
		}
	}

	public ConfigManager(Plugin plugin) {
		this.plugin = plugin;
		plugin.saveDefaultConfig();
		FileConfiguration config = plugin.getConfig();
		config.options().copyDefaults(true);
		try {
			ConfigurationSection dreamSection = config.getConfigurationSection("dream");
			dreamWorldName = dreamSection.getString("world name");
			noAnimalSpawning = dreamSection.getBoolean("no animal spawning");
			noMonsterSpawning = dreamSection.getBoolean("no monster spawning");
			dreamChance = dreamSection.getInt("chance");
			minDurationSeconds = dreamSection.getInt("min duration in seconds");
			maxDurationSeconds = dreamSection.getInt("max duration in seconds");
			spawnRandomly = dreamSection.getBoolean("spawn randomly each time");
			dreamSpawns = SoftLocation.getFromStringList(dreamSection.getStringList("random spawns"));
			applyInitialGamemode = dreamSection.getBoolean("gamemode.apply");
			initialGamemode = GameMode.getByValue(dreamSection.getInt("gamemode.initial gamemode"));
			applyInitialHealth = dreamSection.getBoolean("health.apply");
			initialHealth = dreamSection.getInt("health.initial health");
			applyInitialHunger = dreamSection.getBoolean("hunger.apply");
			initialHunger = dreamSection.getInt("hunger.initial hunger");
			applyInitialPotionEffects = dreamSection.getBoolean("potion effects.apply");
			initialPotionEffects = new ArrayList<PotionEffect>();
			ConfigurationSection potionsSection = dreamSection.getConfigurationSection("potion effects.initial potion effects");
			if (potionsSection != null) {
				for (String type : potionsSection.getKeys(false)) {
					ConfigurationSection potionSection = potionsSection.getConfigurationSection(type);
					if (potionSection == null) continue;
					PotionEffectType potionType = PotionEffectType.getByName(type);
					if (potionType == null) {
						plugin.getLogger().warning("Invalid potion effect type '" + type + "'. Skipping this effect now. You can find a list of all possible PotionEffectTypes by googling 'bukkit PotionEffectType'.");
						continue;
					}
					initialPotionEffects.add(new PotionEffect(potionType, potionSection.getInt("duration"), potionSection.getInt("level")));
				}
			}
			clearAndRestorePlayer = dreamSection.getBoolean("clear and restore player");
			purgeAfterMinutes = dreamSection.getInt("purge saved dream data after x minutes");
			ignoreIfRemainingTimeIsLowerThan = dreamSection.getInt("ignore if remaining seconds is lower than");
			ConfigurationSection fakeTimeSection = dreamSection.getConfigurationSection("fake client time");
			fakeTimeEnabled = fakeTimeSection.getBoolean("enabled") ;
			fakeTime = fakeTimeSection.getInt("time (in ticks)");
			fakeTimeRandomBounds = fakeTimeSection.getInt("random bounds");
			fakeTimeFixed = fakeTimeSection.getBoolean("fixed time");
			fakeRain = dreamSection.getBoolean("fake client weather.raining");
			ConfigurationSection disabledSection = dreamSection.getConfigurationSection("disabled");
			hungerDisabled = disabledSection.getBoolean("hunger");
			fallDamageDisabled = disabledSection.getBoolean("fall damage");
		    entityDamageDisabled = disabledSection.getBoolean("entity damage");
		    allDamageDisabled = disabledSection.getBoolean("all damage");
			weatherDisabled = disabledSection.getBoolean("weather");
			itemDroppingDisabled = disabledSection.getBoolean("item dropping");
			itemPickupDisabled = disabledSection.getBoolean("item pickup");
			blockPlacingDisabled = disabledSection.getBoolean("block placing");
			blockBreakingDisabled = disabledSection.getBoolean("block breaking");
			allowedCommands = dreamSection.getStringList("allowed commands");
			wasConfigValid = true;
		} catch (Exception e) {
			e.printStackTrace();
			wasConfigValid = false;
		}
	}
