diff --git a/src/main/java/com/saicone/uclansync/core/PlayerUpdateTask.java b/src/main/java/com/saicone/uclansync/core/PlayerUpdateTask.java index f36de33..4f5520b 100644 --- a/src/main/java/com/saicone/uclansync/core/PlayerUpdateTask.java +++ b/src/main/java/com/saicone/uclansync/core/PlayerUpdateTask.java @@ -21,7 +21,7 @@ public PlayerUpdateTask(ClanUpdater updater) { public String getPlayersAsJson() { // No need to use JsonObject class, just simple formatting with StringBuilder StringBuilder builder = new StringBuilder(); - connected.forEach((player, uuid) -> builder.append(", \"").append(player).append("\": \"").append(uuid).append("\"")); + new HashMap<>(connected).forEach((player, uuid) -> builder.append(", \"").append(player).append("\": \"").append(uuid).append("\"")); return "{" + (builder.length() > 0 ? builder.substring(2) : "") + "}"; } diff --git a/src/main/java/com/saicone/uclansync/util/Config.java b/src/main/java/com/saicone/uclansync/util/Config.java deleted file mode 100644 index 5a0d61f..0000000 --- a/src/main/java/com/saicone/uclansync/util/Config.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.saicone.uclansync.util; - -import org.bukkit.configuration.ConfigurationSection; - -import java.util.HashMap; -import java.util.Map; - -public class Config { - - Config() { - } - - @SuppressWarnings("unchecked") - public static Map of(Map map) { - try { - return (Map) map; - } catch (ClassCastException e) { - Map finalMap = new HashMap<>(); - map.forEach((key, value) -> finalMap.put(String.valueOf(key), value)); - return finalMap; - } - } - - public static String findKey(Iterable iterable, String key) { - for (String s : iterable) { - if (s.equalsIgnoreCase(key)) { - return s; - } - } - return null; - } - - public static T getValue(Map map, String key) { - return getValue(map, key, null); - } - - @SuppressWarnings("unchecked") - public static T getValue(Map map, String key, T def) { - if (map != null) { - String found = findKey(map.keySet(), key); - if (found != null) { - try { - return (T) map.get(found); - } catch (ClassCastException ignored) { } - } - } - return def; - } - - public static Map toMap(ConfigurationSection section) { - Map map = new HashMap<>(); - section.getKeys(false).forEach((key) -> { - Object object = section.get(key); - if (object instanceof ConfigurationSection) { - map.put(key, toMap((ConfigurationSection) object)); - } else { - map.put(key, object); - } - }); - return map; - } -}