This commit is contained in:
NuclearW 2012-05-17 21:02:26 -04:00
parent 3d6e490505
commit 01235ff398

View File

@ -361,9 +361,9 @@ public class mcMMO extends JavaPlugin {
} }
treasuresConfig = YamlConfiguration.loadConfiguration(treasuresConfigFile); treasuresConfig = YamlConfiguration.loadConfiguration(treasuresConfigFile);
InputStream defConfigStream = getResource("treasures.yml"); // Look for defaults in the jar
if (defConfigStream != null) { if (isInJar("treasures.yml")) {
InputStream defConfigStream = getResource("treasures.yml");
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
treasuresConfig.setDefaults(defConfig); treasuresConfig.setDefaults(defConfig);
} }
@ -414,9 +414,9 @@ public class mcMMO extends JavaPlugin {
} }
toolsConfig = YamlConfiguration.loadConfiguration(toolsConfigFile); toolsConfig = YamlConfiguration.loadConfiguration(toolsConfigFile);
InputStream defConfigStream = getResource("tools.yml"); // Look for defaults in the jar
if (defConfigStream != null) { if (isInJar("tools.yml")) {
InputStream defConfigStream = getResource("tools.yml");
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
toolsConfig.setDefaults(defConfig); toolsConfig.setDefaults(defConfig);
} }
@ -467,9 +467,9 @@ public class mcMMO extends JavaPlugin {
} }
armorConfig = YamlConfiguration.loadConfiguration(armorConfigFile); armorConfig = YamlConfiguration.loadConfiguration(armorConfigFile);
InputStream defConfigStream = getResource("armor.yml"); // Look for defaults in the jar
if (defConfigStream != null) { if (isInJar("armor.yml")) {
InputStream defConfigStream = getResource("armor.yml");
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
armorConfig.setDefaults(defConfig); armorConfig.setDefaults(defConfig);
} }
@ -520,9 +520,9 @@ public class mcMMO extends JavaPlugin {
} }
blocksConfig = YamlConfiguration.loadConfiguration(blocksConfigFile); blocksConfig = YamlConfiguration.loadConfiguration(blocksConfigFile);
InputStream defConfigStream = getResource("blocks.yml"); // Look for defaults in the jar
if (defConfigStream != null) { if (isInJar("blocks.yml")) {
InputStream defConfigStream = getResource("blocks.yml");
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
blocksConfig.setDefaults(defConfig); blocksConfig.setDefaults(defConfig);
} }
@ -556,4 +556,9 @@ public class mcMMO extends JavaPlugin {
getLogger().severe("Could not save config to " + blocksConfigFile + ex.toString()); getLogger().severe("Could not save config to " + blocksConfigFile + ex.toString());
} }
} }
public boolean isInJar(String resource) {
InputStream iStream = getResource(resource);
return iStream != null;
}
} }