mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-23 10:35:22 +01:00
Fixed issue with saving default config.
This commit is contained in:
parent
820775982a
commit
84ea6cf9fd
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "UltimateStacker"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "1.2.5"
|
||||
version: "1.2.6"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user