Skip to content

Commit

Permalink
Changed SuperPerms attachment clearing. Thx to Heroes
Browse files Browse the repository at this point in the history
  • Loading branch information
t3hk0d3 committed Oct 6, 2011
1 parent 6e53786 commit 85b17b1
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/main/java/ru/tehkode/permissions/bukkit/BukkitPermissions.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,22 @@ protected void updatePermissions(Player player, String world) {
if (player == null || !this.plugin.isEnabled()) {
return;
}

if (!this.attachments.containsKey(player)) {
this.attachments.put(player, player.addAttachment(plugin));
}


if (world == null) {
world = player.getWorld().getName();
}

// Remove attachment
if(this.attachments.containsKey(player)){
this.attachments.get(player).remove();
}

PermissionAttachment attachment = this.attachments.get(player);

PermissionAttachment attachment = player.addAttachment(plugin);

this.attachments.put(player, attachment);

PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
String permissions[] = user.getPermissions(world);

// clear permissions
for (String permission : attachment.getPermissions().keySet()) {
attachment.unsetPermission(permission);
}

if (dumpMatchedPermissions) { // find matching permissions
Set<Permission> registeredPermissions = Bukkit.getServer().getPluginManager().getPermissions();
Expand Down

0 comments on commit 85b17b1

Please sign in to comment.