mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-27 21:29:47 +01:00
Fix (un)setting nodes through Vault with null worlds (#1826)
This commit is contained in:
parent
01e17adf82
commit
6fdd349654
@ -51,7 +51,6 @@ import net.luckperms.api.context.MutableContextSet;
|
|||||||
import net.luckperms.api.model.data.DataType;
|
import net.luckperms.api.model.data.DataType;
|
||||||
import net.luckperms.api.query.Flag;
|
import net.luckperms.api.query.Flag;
|
||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
import net.luckperms.api.util.Result;
|
|
||||||
import net.luckperms.api.util.Tristate;
|
import net.luckperms.api.util.Tristate;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
@ -438,7 +437,11 @@ public class LuckPermsVaultPermission extends AbstractVaultPermission {
|
|||||||
logMsg("#holderAddPermission: %s - %s - %s", holder.getPlainDisplayName(), permission, world);
|
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 holderSave(holder);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -452,6 +455,10 @@ public class LuckPermsVaultPermission extends AbstractVaultPermission {
|
|||||||
logMsg("#holderRemovePermission: %s - %s - %s", holder.getPlainDisplayName(), permission, world);
|
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()) {
|
if (holder.unsetNode(DataType.NORMAL, NodeBuilders.determineMostApplicable(permission).withContext(DefaultContextKeys.SERVER_KEY, getVaultServer()).withContext(DefaultContextKeys.WORLD_KEY, world).build()).wasSuccessful()) {
|
||||||
return holderSave(holder);
|
return holderSave(holder);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ import me.lucko.luckperms.nukkit.inject.dummy.DummyPlugin;
|
|||||||
import net.luckperms.api.model.data.DataType;
|
import net.luckperms.api.model.data.DataType;
|
||||||
import net.luckperms.api.node.Node;
|
import net.luckperms.api.node.Node;
|
||||||
import net.luckperms.api.node.metadata.NodeMetadataKey;
|
import net.luckperms.api.node.metadata.NodeMetadataKey;
|
||||||
import net.luckperms.api.util.Result;
|
|
||||||
|
|
||||||
import cn.nukkit.permission.Permission;
|
import cn.nukkit.permission.Permission;
|
||||||
import cn.nukkit.permission.PermissionAttachment;
|
import cn.nukkit.permission.PermissionAttachment;
|
||||||
@ -192,7 +191,7 @@ public class LPPermissionAttachment extends PermissionAttachment {
|
|||||||
|
|
||||||
// set the transient node
|
// set the transient node
|
||||||
User user = this.permissible.getUser();
|
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) {
|
private void unsetPermissionInternal(String name) {
|
||||||
|
@ -40,7 +40,6 @@ public class SpongeGroup extends Group implements SpongePermissionHolder {
|
|||||||
@Override
|
@Override
|
||||||
protected void invalidateCache() {
|
protected void invalidateCache() {
|
||||||
super.invalidateCache();
|
super.invalidateCache();
|
||||||
|
|
||||||
this.spongeData.fireUpdateEvent();
|
this.spongeData.fireUpdateEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user