/*
 * Copyright (c) 2013, LankyLord
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * * Redistributions of source code must retain the above copyright notice, this
 *   list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package net.lankylord.simplehomes.managers;

import net.lankylord.simplehomes.SimpleHomes;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;

/** @author LankyLord */
public class HomeFileManager {

    private final SimpleHomes instance;
    private FileConfiguration Homes = null;
    private File HomesFile = null;

    public HomeFileManager(SimpleHomes instance) {
        this.instance = instance;
    }

    public FileConfiguration getHomes() {
        if (Homes == null)
            this.reloadHomes();
        return Homes;
    }

    void reloadHomes() {
        if (HomesFile == null)
            HomesFile = new File(instance.getDataFolder(), "Homes.yml");
        Homes = YamlConfiguration.loadConfiguration(HomesFile);

        InputStream defHomes = instance.getResource("Homes.yml");
        if (defHomes != null) {
            YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defHomes);
            Homes.setDefaults(defConfig);
        }
    }

    public void saveHomes() {
        if (Homes == null || HomesFile == null)
            return;
        try {
            getHomes().save(HomesFile);
        } catch (IOException ex) {
            instance.getLogger().log(Level.SEVERE, "Could not save config to " + HomesFile, ex);
        }
    }
}

@@ -1798,17 +1798,17 @@
 uration 
-H
+h
 omes = n
@@ -1829,17 +1829,17 @@
 te File 
-H
+h
 omesFile
@@ -1986,33 +1986,33 @@
 ) %7B%0A        if (
-H
+h
 omes == null)%0A  
@@ -2056,17 +2056,17 @@
  return 
-H
+h
 omes;%0A  
@@ -2103,25 +2103,25 @@
         if (
-H
+h
 omesFile == 
@@ -2134,25 +2134,25 @@
             
-H
+h
 omesFile = n
@@ -2203,25 +2203,25 @@
 %22);%0A        
-H
+h
 omes = YamlC
@@ -2251,17 +2251,17 @@
 uration(
-H
+h
 omesFile
@@ -2463,17 +2463,17 @@
         
-H
+h
 omes.set
@@ -2552,17 +2552,17 @@
     if (
-H
+h
 omes == 
@@ -2569,17 +2569,17 @@
 null %7C%7C 
-H
+h
 omesFile
@@ -2650,17 +2650,17 @@
 ().save(
-H
+h
 omesFile
@@ -2778,17 +2778,17 @@
  to %22 + 
-H
+h
 omesFile

Fix case of variable names