Fix Sponge subject data permission overrides

This commit is contained in:
Luck 2016-11-23 22:17:49 +00:00
parent 61eb86b3a0
commit 69b3c96e09
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -133,11 +133,22 @@ public class LuckPermsSubjectData implements SubjectData {
builder.withExtraContext(ct.getKey(), ct.getValue()); builder.withExtraContext(ct.getKey(), ct.getValue());
} }
Node node = builder.build();
// Workaround: unset the inverse, to allow false -> true, true -> false overrides.
try { try {
if (enduring) { if (enduring) {
holder.setPermission(builder.build()); holder.unsetPermission(node);
}else {
holder.unsetTransientPermission(node);
}
} catch (ObjectLacksException ignored) {}
try {
if (enduring) {
holder.setPermission(node);
} else { } else {
holder.setTransientPermission(builder.build()); holder.setTransientPermission(node);
} }
} catch (ObjectAlreadyHasException ignored) {} } catch (ObjectAlreadyHasException ignored) {}