Merge pull request #13 from desht/master

Permissions handling bugfixes
This commit is contained in:
Nick Minkler 2011-11-02 11:20:05 -07:00
commit f6d3770e5f
2 changed files with 17 additions and 17 deletions

View File

@ -213,7 +213,7 @@ public abstract class Permission {
* @return Success or Failure * @return Success or Failure
*/ */
public boolean playerRemoveTransient(Player player, String permission) { public boolean playerRemoveTransient(Player player, String permission) {
return playerRemove(player.getWorld().getName(), player.getName(), permission); return playerRemoveTransient(player.getWorld().getName(), player.getName(), permission);
} }
/** /**

View File

@ -62,7 +62,6 @@ public class Permission_PermissionsBukkit extends Permission {
} }
} }
private class PermissionServerListener extends ServerListener { private class PermissionServerListener extends ServerListener {
Permission_PermissionsBukkit permission = null; Permission_PermissionsBukkit permission = null;
@ -133,7 +132,7 @@ public class Permission_PermissionsBukkit extends Permission {
if (world != null) { if (world != null) {
permission = world + ":" + permission; permission = world + ":" + permission;
} }
return plugin.getServer().dispatchCommand(ccs, "permission player setperm " + player + " " + permission + " true"); return plugin.getServer().dispatchCommand(ccs, "permissions player setperm " + player + " " + permission + " true");
} }
@Override @Override
@ -144,7 +143,7 @@ public class Permission_PermissionsBukkit extends Permission {
} }
for (PermissionAttachmentInfo paInfo : p.getEffectivePermissions()) { for (PermissionAttachmentInfo paInfo : p.getEffectivePermissions()) {
if (paInfo.getAttachment().getPlugin().equals(plugin)) { if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
paInfo.getAttachment().setPermission(permission, true); paInfo.getAttachment().setPermission(permission, true);
return true; return true;
} }
@ -161,7 +160,7 @@ public class Permission_PermissionsBukkit extends Permission {
if (world != null) { if (world != null) {
permission = world + ":" + permission; permission = world + ":" + permission;
} }
return plugin.getServer().dispatchCommand(ccs, "permission player unsetperm " + player + " " + permission); return plugin.getServer().dispatchCommand(ccs, "permissions player unsetperm " + player + " " + permission);
} }
@Override @Override
@ -171,8 +170,9 @@ public class Permission_PermissionsBukkit extends Permission {
throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!"); throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!");
} }
for (PermissionAttachmentInfo paInfo : p.getEffectivePermissions()) { for (PermissionAttachmentInfo paInfo : p.getEffectivePermissions()) {
if (paInfo.getAttachment().getPlugin().equals(plugin)) { if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
return paInfo.getAttachment().getPermissions().remove(permission); paInfo.getAttachment().unsetPermission(permission);
return true;
} }
} }
return false; return false;
@ -197,7 +197,7 @@ public class Permission_PermissionsBukkit extends Permission {
if (world != null) { if (world != null) {
permission = world + ":" + permission; permission = world + ":" + permission;
} }
return plugin.getServer().dispatchCommand(ccs, "permission group setperm " + group + " " + permission + " true"); return plugin.getServer().dispatchCommand(ccs, "permissions group setperm " + group + " " + permission + " true");
} }
@Override @Override
@ -205,7 +205,7 @@ public class Permission_PermissionsBukkit extends Permission {
if (world != null) { if (world != null) {
permission = world + ":" + permission; permission = world + ":" + permission;
} }
return plugin.getServer().dispatchCommand(ccs, "permission group unsetperm " + group + " " + permission); return plugin.getServer().dispatchCommand(ccs, "permissions group unsetperm " + group + " " + permission);
} }
@Override @Override
@ -226,7 +226,7 @@ public class Permission_PermissionsBukkit extends Permission {
if (world != null) { if (world != null) {
throw new UnsupportedOperationException(getName() + " does not support world based groups."); throw new UnsupportedOperationException(getName() + " does not support world based groups.");
} }
return plugin.getServer().dispatchCommand(ccs, "permission player addgroup " + group + " " + player); return plugin.getServer().dispatchCommand(ccs, "permissions player addgroup " + group + " " + player);
} }
@Override @Override
@ -234,7 +234,7 @@ public class Permission_PermissionsBukkit extends Permission {
if (world != null) { if (world != null) {
throw new UnsupportedOperationException(getName() + " does not support world based groups."); throw new UnsupportedOperationException(getName() + " does not support world based groups.");
} }
return plugin.getServer().dispatchCommand(ccs, "permission player removegroup " + group + " " + player); return plugin.getServer().dispatchCommand(ccs, "permissions player removegroup " + group + " " + player);
} }
@Override @Override