Slit refreshPermissions() in multiple functions

This commit is contained in:
Michel Roux 2012-05-15 08:54:40 +02:00
parent 79bc01d986
commit 4bac4a1d70

View File

@ -145,21 +145,29 @@ public class SimplyPlugin extends JavaPlugin {
} }
} }
protected void refreshPermissions() { protected void refreshConfig() {
try { try {
getConfig().save(configFile); getConfig().save(configFile);
reloadConfig(); reloadConfig();
} catch (IOException e) { } catch (IOException e) {
getLogger().warning("Failed to write changed config.yml: " + e.getMessage()); getLogger().warning("Failed to write changed config.yml: " + e.getMessage());
} }
for (String player : permissions.keySet()) { }
protected void refreshPlayerPermissions(String player) {
refreshConfig();
PermissionAttachment attachment = permissions.get(player); PermissionAttachment attachment = permissions.get(player);
for (String key : attachment.getPermissions().keySet()) { for (String key : attachment.getPermissions().keySet()) {
attachment.unsetPermission(key); attachment.unsetPermission(key);
} }
calculateAttachment(getServer().getPlayer(player)); calculateAttachment(getServer().getPlayer(player));
} }
protected void refreshPermissions() {
refreshConfig();
for (String player : permissions.keySet()) {
refreshPlayerPermissions(player);
}
} }
public ConfigurationSection getNode(String node) { public ConfigurationSection getNode(String node) {