diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b9012c4..cc3710f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "EpicHeads" path: "/builds/$CI_PROJECT_PATH" - version: "3.0.13" + version: "3.0.14" build: stage: build diff --git a/src/main/java/com/songoda/epicheads/utils/settings/SettingsManager.java b/src/main/java/com/songoda/epicheads/utils/settings/SettingsManager.java index 663b7e3..1c00bb3 100644 --- a/src/main/java/com/songoda/epicheads/utils/settings/SettingsManager.java +++ b/src/main/java/com/songoda/epicheads/utils/settings/SettingsManager.java @@ -33,6 +33,25 @@ public class SettingsManager implements Listener { Bukkit.getPluginManager().registerEvents(this, plugin); } + public static void add(LinkedHashMap map, int index, K key, V value) { + assert (map != null); + assert !map.containsKey(key); + assert (index >= 0) && (index < map.size()); + + int i = 0; + List> rest = new ArrayList<>(); + for (Map.Entry entry : map.entrySet()) { + if (i++ >= index) { + rest.add(entry); + } + } + map.put(key, value); + for (Map.Entry entry : rest) { + map.remove(entry.getKey()); + map.put(entry.getKey(), entry.getValue()); + } + } + @EventHandler public void onInventoryClick(InventoryClickEvent event) { ItemStack clickedItem = event.getCurrentItem(); @@ -294,8 +313,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 +325,4 @@ public class SettingsManager implements Listener { e.printStackTrace(); } } - - public static void add(LinkedHashMap map, int index, K key, V value) { - assert (map != null); - assert !map.containsKey(key); - assert (index >= 0) && (index < map.size()); - - int i = 0; - List> rest = new ArrayList<>(); - for (Map.Entry entry : map.entrySet()) { - if (i++ >= index) { - rest.add(entry); - } - } - map.put(key, value); - for (Map.Entry entry : rest) { - map.remove(entry.getKey()); - map.put(entry.getKey(), entry.getValue()); - } - } } \ No newline at end of file