Fixed issue with saving default config.

This commit is contained in:
Brianna 2019-05-23 23:30:00 -04:00
parent 820775982a
commit 84ea6cf9fd
2 changed files with 4 additions and 21 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "UltimateStacker"
path: "/builds/$CI_PROJECT_PATH"
version: "1.2.5"
version: "1.2.6"
build:
stage: build

View File

@ -294,8 +294,10 @@ public class SettingsManager implements Listener {
}
try {
if (!plugin.getDataFolder().exists())
plugin.getDataFolder().mkdir();
BufferedWriter writer =
new BufferedWriter(new FileWriter(new File(plugin.getDataFolder() + "\\config.yml")));
new BufferedWriter(new FileWriter(new File(plugin.getDataFolder() + File.separator + "config.yml")));
writer.write(config.toString());
writer.flush();
writer.close();
@ -304,23 +306,4 @@ public class SettingsManager implements Listener {
e.printStackTrace();
}
}
public static <K, V> void add(LinkedHashMap<K, V> map, int index, K key, V value) {
assert (map != null);
assert !map.containsKey(key);
assert (index >= 0) && (index < map.size());
int i = 0;
List<Map.Entry<K, V>> rest = new ArrayList<>();
for (Map.Entry<K, V> entry : map.entrySet()) {
if (i++ >= index) {
rest.add(entry);
}
}
map.put(key, value);
for (Map.Entry<K, V> entry : rest) {
map.remove(entry.getKey());
map.put(entry.getKey(), entry.getValue());
}
}
}