From 4bac4a1d70ce956382dfe04917933735d866be78 Mon Sep 17 00:00:00 2001 From: Xefir Date: Tue, 15 May 2012 08:54:40 +0200 Subject: [PATCH] Slit refreshPermissions() in multiple functions --- .../bukkit/simplyperms/SimplyPlugin.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java b/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java index 3f97ebf..3f9eae5 100755 --- a/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java +++ b/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java @@ -145,20 +145,28 @@ public class SimplyPlugin extends JavaPlugin { } } - protected void refreshPermissions() { + protected void refreshConfig() { try { getConfig().save(configFile); reloadConfig(); } catch (IOException e) { getLogger().warning("Failed to write changed config.yml: " + e.getMessage()); } - for (String player : permissions.keySet()) { - PermissionAttachment attachment = permissions.get(player); - for (String key : attachment.getPermissions().keySet()) { - attachment.unsetPermission(key); - } + } - calculateAttachment(getServer().getPlayer(player)); + protected void refreshPlayerPermissions(String player) { + refreshConfig(); + PermissionAttachment attachment = permissions.get(player); + for (String key : attachment.getPermissions().keySet()) { + attachment.unsetPermission(key); + } + calculateAttachment(getServer().getPlayer(player)); + } + + protected void refreshPermissions() { + refreshConfig(); + for (String player : permissions.keySet()) { + refreshPlayerPermissions(player); } }