Only apply DefaultsProcessor for users

This commit is contained in:
Luck 2019-12-29 18:01:13 +00:00
parent 46dc4e5104
commit 4e9b11f30a
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 8 additions and 9 deletions

View File

@ -37,6 +37,7 @@ import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
import me.lucko.luckperms.common.calculator.processor.RegexProcessor; import me.lucko.luckperms.common.calculator.processor.RegexProcessor;
import me.lucko.luckperms.common.calculator.processor.WildcardProcessor; import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
import me.lucko.luckperms.common.config.ConfigKeys; import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.model.HolderType;
import net.luckperms.api.query.QueryOptions; import net.luckperms.api.query.QueryOptions;
@ -66,7 +67,7 @@ public class BukkitCalculatorFactory implements CalculatorFactory {
} }
boolean op = queryOptions.option(BukkitContextManager.OP_OPTION).orElse(false); boolean op = queryOptions.option(BukkitContextManager.OP_OPTION).orElse(false);
if (this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) { if (metadata.getHolderType() == HolderType.USER && this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) {
processors.add(new DefaultsProcessor(this.plugin, op)); processors.add(new DefaultsProcessor(this.plugin, op));
} }

View File

@ -66,15 +66,13 @@ public class NukkitCalculatorFactory implements CalculatorFactory {
processors.add(new WildcardProcessor()); processors.add(new WildcardProcessor());
} }
if (metadata.getHolderType() == HolderType.USER) { boolean op = queryOptions.option(NukkitContextManager.OP_OPTION).orElse(false);
boolean op = queryOptions.option(NukkitContextManager.OP_OPTION).orElse(false); if (metadata.getHolderType() == HolderType.USER && this.plugin.getConfiguration().get(ConfigKeys.APPLY_NUKKIT_DEFAULT_PERMISSIONS)) {
if (this.plugin.getConfiguration().get(ConfigKeys.APPLY_NUKKIT_DEFAULT_PERMISSIONS)) { processors.add(new DefaultsProcessor(this.plugin, op));
processors.add(new DefaultsProcessor(this.plugin, op)); }
}
if (op) { if (op) {
processors.add(new OpProcessor()); processors.add(new OpProcessor());
}
} }
return new PermissionCalculator(this.plugin, metadata, processors.build()); return new PermissionCalculator(this.plugin, metadata, processors.build());