From 346533098da18e7f1135ff316a28c3d19daf74c1 Mon Sep 17 00:00:00 2001 From: Xefir Date: Wed, 9 May 2012 18:02:27 +0200 Subject: [PATCH] LINKEDHASHMAP ORDER IS ALL RRRRAAAAAAAAA (non i'm not angry :@) --- src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java | 5 +++-- src/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java | 8 ++++---- src/net/crystalyx/bukkit/simplyperms/io/ConfigSQL.java | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java b/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java index 26ef674..961679c 100755 --- a/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java +++ b/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -207,7 +208,7 @@ public class SimplyPlugin extends JavaPlugin { return calculateGroupPermissions(default_group, world); } - Map perms = new HashMap(); + Map perms = new LinkedHashMap(); List groups = config.getPlayerGroups(player); if (groups.isEmpty()) groups.add(default_group); perms.putAll(config.getPlayerPermissions(player)); @@ -227,7 +228,7 @@ public class SimplyPlugin extends JavaPlugin { private Map calculateGroupPermissions(String group, String world) { if (getNode("groups/" + group) == null) { - return new HashMap(); + return new LinkedHashMap(); } Map perms = config.getGroupPermissions(group); diff --git a/src/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java b/src/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java index 3568bb7..2541015 100755 --- a/src/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java +++ b/src/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java @@ -1,7 +1,7 @@ package net.crystalyx.bukkit.simplyperms.io; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -106,7 +106,7 @@ public class ConfigFile implements PermsConfig { @Override public Map getPlayerPermissions(String player, String world) { - Map finalPerms = new HashMap(); + Map finalPerms = new LinkedHashMap(); String permNode = (!world.isEmpty()) ? "users/" + player + "/worlds/" + world : "users/" + player + "/permissions"; if (plugin.getNode(permNode) != null) { for (Entry permPlayer : plugin.getNode(permNode).getValues(false).entrySet()) { @@ -193,7 +193,7 @@ public class ConfigFile implements PermsConfig { @Override public Map getGroupPermissions(String group, String world) { if (group.isEmpty()) group = getDefaultGroup(); - Map finalPerms = new HashMap(); + Map finalPerms = new LinkedHashMap(); String permNode = (!world.isEmpty()) ? "groups/" + group + "/worlds/" + world : "groups/" + group + "/permissions"; if (plugin.getNode(permNode) != null) { for (Entry permGroup : plugin.getNode(permNode).getValues(false).entrySet()) { @@ -262,7 +262,7 @@ public class ConfigFile implements PermsConfig { return plugin.getNode("messages").getValues(false); } else { - return new HashMap(); + return new LinkedHashMap(); } } diff --git a/src/net/crystalyx/bukkit/simplyperms/io/ConfigSQL.java b/src/net/crystalyx/bukkit/simplyperms/io/ConfigSQL.java index 554ba2c..df4a9ad 100755 --- a/src/net/crystalyx/bukkit/simplyperms/io/ConfigSQL.java +++ b/src/net/crystalyx/bukkit/simplyperms/io/ConfigSQL.java @@ -5,7 +5,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.sql.Connection; @@ -244,7 +244,7 @@ public class ConfigSQL implements PermsConfig { @Override public Map getPlayerPermissions(String player, String world) { - Map results = new HashMap(); + Map results = new LinkedHashMap(); if (init()) { try { PreparedStatement sql = connection.prepareStatement("SELECT " + column_permission + ", " + column_value + " FROM " + table_players + " WHERE " + column_playerid + " = LOWER(?) AND " + column_world + " = ?");