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,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);
}
}