From d786b6abb2dcdbe9134f0678e99a9e10f9033cad Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 8 Sep 2016 17:28:31 +0100 Subject: [PATCH] Fix removing negative nodes --- .../java/me/lucko/luckperms/core/PermissionHolder.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java index 8743065c5..d549ddf56 100644 --- a/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java @@ -390,7 +390,7 @@ public abstract class PermissionHolder { * @throws ObjectAlreadyHasException if the holder has this permission already */ public void setPermission(Node node) throws ObjectAlreadyHasException { - if (hasPermission(node, false) == Tristate.TRUE) { + if (hasPermission(node, false) != Tristate.UNDEFINED) { throw new ObjectAlreadyHasException(); } @@ -404,7 +404,7 @@ public abstract class PermissionHolder { * @throws ObjectAlreadyHasException if the holder has this permission already */ public void setTransientPermission(Node node) throws ObjectAlreadyHasException { - if (hasPermission(node, true) == Tristate.TRUE) { + if (hasPermission(node, true) != Tristate.UNDEFINED) { throw new ObjectAlreadyHasException(); } @@ -442,7 +442,7 @@ public abstract class PermissionHolder { * @throws ObjectLacksException if the holder doesn't have this node already */ public void unsetPermission(Node node) throws ObjectLacksException { - if (hasPermission(node, false) != Tristate.TRUE) { + if (hasPermission(node, false) == Tristate.UNDEFINED) { throw new ObjectLacksException(); } @@ -468,7 +468,7 @@ public abstract class PermissionHolder { * @throws ObjectLacksException if the holder doesn't have this node already */ public void unsetTransientPermission(Node node) throws ObjectLacksException { - if (hasPermission(node, true) == Tristate.FALSE) { + if (hasPermission(node, true) == Tristate.UNDEFINED) { throw new ObjectLacksException(); }