Fix (un)setting nodes through Vault with null worlds (#1826)

This commit is contained in:
Luck 2019-11-29 12:16:24 +00:00
parent 01e17adf82
commit 6fdd349654
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
3 changed files with 10 additions and 5 deletions

View File

@ -51,7 +51,6 @@ import net.luckperms.api.context.MutableContextSet;
import net.luckperms.api.model.data.DataType;
import net.luckperms.api.query.Flag;
import net.luckperms.api.query.QueryOptions;
import net.luckperms.api.util.Result;
import net.luckperms.api.util.Tristate;
import net.milkbowl.vault.permission.Permission;
@ -438,7 +437,11 @@ public class LuckPermsVaultPermission extends AbstractVaultPermission {
logMsg("#holderAddPermission: %s - %s - %s", holder.getPlainDisplayName(), permission, world);
}
if (((Result) holder.setNode(DataType.NORMAL, NodeBuilders.determineMostApplicable(permission).value(true).withContext(DefaultContextKeys.SERVER_KEY, getVaultServer()).withContext(DefaultContextKeys.WORLD_KEY, world).build(), true)).wasSuccessful()) {
if (world == null) {
world = "global";
}
if (holder.setNode(DataType.NORMAL, NodeBuilders.determineMostApplicable(permission).value(true).withContext(DefaultContextKeys.SERVER_KEY, getVaultServer()).withContext(DefaultContextKeys.WORLD_KEY, world).build(), true).wasSuccessful()) {
return holderSave(holder);
}
return false;
@ -452,6 +455,10 @@ public class LuckPermsVaultPermission extends AbstractVaultPermission {
logMsg("#holderRemovePermission: %s - %s - %s", holder.getPlainDisplayName(), permission, world);
}
if (world == null) {
world = "global";
}
if (holder.unsetNode(DataType.NORMAL, NodeBuilders.determineMostApplicable(permission).withContext(DefaultContextKeys.SERVER_KEY, getVaultServer()).withContext(DefaultContextKeys.WORLD_KEY, world).build()).wasSuccessful()) {
return holderSave(holder);
}

View File

@ -35,7 +35,6 @@ import me.lucko.luckperms.nukkit.inject.dummy.DummyPlugin;
import net.luckperms.api.model.data.DataType;
import net.luckperms.api.node.Node;
import net.luckperms.api.node.metadata.NodeMetadataKey;
import net.luckperms.api.util.Result;
import cn.nukkit.permission.Permission;
import cn.nukkit.permission.PermissionAttachment;
@ -192,7 +191,7 @@ public class LPPermissionAttachment extends PermissionAttachment {
// set the transient node
User user = this.permissible.getUser();
((Result) user.setNode(DataType.TRANSIENT, node, true)).wasSuccessful();
user.setNode(DataType.TRANSIENT, node, true).wasSuccessful();
}
private void unsetPermissionInternal(String name) {

View File

@ -40,7 +40,6 @@ public class SpongeGroup extends Group implements SpongePermissionHolder {
@Override
protected void invalidateCache() {
super.invalidateCache();
this.spongeData.fireUpdateEvent();
}