mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-29 19:51:40 +01:00
Add option for Sponge style wildcards on other platforms (#1625)
This commit is contained in:
parent
6631e9144e
commit
10fbc24f43
@ -25,7 +25,6 @@
|
||||
|
||||
package net.luckperms.api.node.matcher;
|
||||
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import net.luckperms.api.node.Node;
|
||||
import net.luckperms.api.node.NodeEqualityPredicate;
|
||||
|
@ -35,6 +35,7 @@ import me.lucko.luckperms.common.calculator.PermissionCalculator;
|
||||
import me.lucko.luckperms.common.calculator.processor.MapProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.RegexProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.SpongeWildcardProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.model.HolderType;
|
||||
@ -66,6 +67,10 @@ public class BukkitCalculatorFactory implements CalculatorFactory {
|
||||
processors.add(new WildcardProcessor());
|
||||
}
|
||||
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS_SPONGE)) {
|
||||
processors.add(new SpongeWildcardProcessor());
|
||||
}
|
||||
|
||||
boolean op = queryOptions.option(BukkitContextManager.OP_OPTION).orElse(false);
|
||||
if (metadata.getHolderType() == HolderType.USER && this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) {
|
||||
processors.add(new DefaultsProcessor(this.plugin, op));
|
||||
|
@ -444,6 +444,14 @@ meta-value-selection:
|
||||
# permissions matching the wildcard.
|
||||
apply-wildcards: true
|
||||
|
||||
# If LuckPerms should resolve and apply permissions according to the Sponge style implicit wildcard
|
||||
# inheritance system.
|
||||
#
|
||||
# - That being: If a user has been granted "example", then the player should have also be
|
||||
# automatically granted "example.function", "example.another", "example.deeper.nesting",
|
||||
# and so on.
|
||||
apply-sponge-implicit-wildcards: false
|
||||
|
||||
# If the plugin should parse regex permissions.
|
||||
#
|
||||
# - If set to true, LuckPerms will detect regex permissions, marked with "r=" at the start of the
|
||||
|
@ -34,6 +34,7 @@ import me.lucko.luckperms.common.calculator.PermissionCalculator;
|
||||
import me.lucko.luckperms.common.calculator.processor.MapProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.RegexProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.SpongeWildcardProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
|
||||
@ -60,6 +61,10 @@ public class BungeeCalculatorFactory implements CalculatorFactory {
|
||||
processors.add(new WildcardProcessor());
|
||||
}
|
||||
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS_SPONGE)) {
|
||||
processors.add(new SpongeWildcardProcessor());
|
||||
}
|
||||
|
||||
return new PermissionCalculator(this.plugin, metadata, processors.build());
|
||||
}
|
||||
}
|
||||
|
@ -452,6 +452,14 @@ meta-value-selection:
|
||||
# permissions matching the wildcard.
|
||||
apply-wildcards: true
|
||||
|
||||
# If LuckPerms should resolve and apply permissions according to the Sponge style implicit wildcard
|
||||
# inheritance system.
|
||||
#
|
||||
# - That being: If a user has been granted "example", then the player should have also be
|
||||
# automatically granted "example.function", "example.another", "example.deeper.nesting",
|
||||
# and so on.
|
||||
apply-sponge-implicit-wildcards: false
|
||||
|
||||
# If the plugin should parse regex permissions.
|
||||
#
|
||||
# - If set to true, LuckPerms will detect regex permissions, marked with "r=" at the start of the
|
||||
|
@ -23,10 +23,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.sponge.calculator;
|
||||
package me.lucko.luckperms.common.calculator.processor;
|
||||
|
||||
import me.lucko.luckperms.common.calculator.processor.AbstractPermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
||||
import me.lucko.luckperms.common.node.AbstractNode;
|
||||
|
@ -44,6 +44,7 @@ import me.lucko.luckperms.common.util.ImmutableCollectors;
|
||||
import net.luckperms.api.metastacking.DuplicateRemovalFunction;
|
||||
import net.luckperms.api.metastacking.MetaStackDefinition;
|
||||
import net.luckperms.api.model.data.TemporaryNodeMergeStrategy;
|
||||
import net.luckperms.api.platform.Platform;
|
||||
import net.luckperms.api.query.Flag;
|
||||
import net.luckperms.api.query.QueryMode;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
@ -199,6 +200,14 @@ public final class ConfigKeys {
|
||||
*/
|
||||
public static final ConfigKey<Boolean> APPLYING_WILDCARDS = enduringKey(booleanKey("apply-wildcards", true));
|
||||
|
||||
/**
|
||||
* If Sponge's implicit permission inheritance system should be applied
|
||||
*/
|
||||
public static final ConfigKey<Boolean> APPLYING_WILDCARDS_SPONGE = enduringKey(customKey(c -> {
|
||||
boolean def = c.getPlugin().getBootstrap().getType() == Platform.Type.SPONGE;
|
||||
return c.getBoolean("apply-sponge-implicit-wildcards", def);
|
||||
}));
|
||||
|
||||
/**
|
||||
* If regex permissions are being applied
|
||||
*/
|
||||
@ -244,11 +253,6 @@ public final class ConfigKeys {
|
||||
*/
|
||||
public static final ConfigKey<Boolean> APPLY_BUNGEE_CONFIG_PERMISSIONS = enduringKey(booleanKey("apply-bungee-config-permissions", false));
|
||||
|
||||
/**
|
||||
* If Sponge's implicit permission inheritance system should be applied
|
||||
*/
|
||||
public static final ConfigKey<Boolean> APPLY_SPONGE_IMPLICIT_WILDCARDS = enduringKey(booleanKey("apply-sponge-implicit-wildcards", true));
|
||||
|
||||
/**
|
||||
* If Sponge default subjects should be applied
|
||||
*/
|
||||
|
@ -33,6 +33,7 @@ import me.lucko.luckperms.common.calculator.PermissionCalculator;
|
||||
import me.lucko.luckperms.common.calculator.processor.MapProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.RegexProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.SpongeWildcardProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.model.HolderType;
|
||||
@ -66,6 +67,10 @@ public class NukkitCalculatorFactory implements CalculatorFactory {
|
||||
processors.add(new WildcardProcessor());
|
||||
}
|
||||
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS_SPONGE)) {
|
||||
processors.add(new SpongeWildcardProcessor());
|
||||
}
|
||||
|
||||
boolean op = queryOptions.option(NukkitContextManager.OP_OPTION).orElse(false);
|
||||
if (metadata.getHolderType() == HolderType.USER && this.plugin.getConfiguration().get(ConfigKeys.APPLY_NUKKIT_DEFAULT_PERMISSIONS)) {
|
||||
processors.add(new DefaultsProcessor(this.plugin, op));
|
||||
|
@ -439,6 +439,14 @@ meta-value-selection:
|
||||
# permissions matching the wildcard.
|
||||
apply-wildcards: true
|
||||
|
||||
# If LuckPerms should resolve and apply permissions according to the Sponge style implicit wildcard
|
||||
# inheritance system.
|
||||
#
|
||||
# - That being: If a user has been granted "example", then the player should have also be
|
||||
# automatically granted "example.function", "example.another", "example.deeper.nesting",
|
||||
# and so on.
|
||||
apply-sponge-implicit-wildcards: false
|
||||
|
||||
# If the plugin should parse regex permissions.
|
||||
#
|
||||
# - If set to true, LuckPerms will detect regex permissions, marked with "r=" at the start of the
|
||||
|
@ -33,6 +33,7 @@ import me.lucko.luckperms.common.calculator.PermissionCalculator;
|
||||
import me.lucko.luckperms.common.calculator.processor.MapProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.RegexProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.SpongeWildcardProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.model.HolderType;
|
||||
@ -61,7 +62,7 @@ public class SpongeCalculatorFactory implements CalculatorFactory {
|
||||
processors.add(new WildcardProcessor());
|
||||
}
|
||||
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLY_SPONGE_IMPLICIT_WILDCARDS)) {
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS_SPONGE)) {
|
||||
processors.add(new SpongeWildcardProcessor());
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,12 @@ import me.lucko.luckperms.common.calculator.CalculatorFactory;
|
||||
import me.lucko.luckperms.common.calculator.PermissionCalculator;
|
||||
import me.lucko.luckperms.common.calculator.processor.MapProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.SpongeWildcardProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
|
||||
import me.lucko.luckperms.common.metastacking.SimpleMetaStackDefinition;
|
||||
import me.lucko.luckperms.common.metastacking.StandardStackElements;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.sponge.calculator.FixedDefaultsProcessor;
|
||||
import me.lucko.luckperms.sponge.calculator.SpongeWildcardProcessor;
|
||||
|
||||
import net.luckperms.api.metastacking.DuplicateRemovalFunction;
|
||||
import net.luckperms.api.metastacking.MetaStackDefinition;
|
||||
|
@ -454,6 +454,14 @@ meta-value-selection {
|
||||
# permissions matching the wildcard.
|
||||
apply-wildcards = true
|
||||
|
||||
# If LuckPerms should resolve and apply permissions according to the Sponge style implicit wildcard
|
||||
# inheritance system.
|
||||
#
|
||||
# - That being: If a user has been granted "example", then the player should have also be
|
||||
# automatically granted "example.function", "example.another", "example.deeper.nesting",
|
||||
# and so on.
|
||||
apply-sponge-implicit-wildcards=true
|
||||
|
||||
# If the plugin should parse regex permissions.
|
||||
#
|
||||
# - If set to true, LuckPerms will detect regex permissions, marked with "r=" at the start of the
|
||||
@ -465,16 +473,6 @@ apply-regex = true
|
||||
# - If set to true, LuckPerms will detect and expand shorthand node patterns.
|
||||
apply-shorthand = true
|
||||
|
||||
# If LuckPerms should resolve and apply permissions according to Sponge's implicit wildcard
|
||||
# inheritance system.
|
||||
#
|
||||
# That being:
|
||||
# If a user has been granted "example", then the player should have also be automatically granted
|
||||
# "example.function", "example.another", "example.deeper.nesting", and so on.
|
||||
#
|
||||
# If this option is set to false, this system will not be applied.
|
||||
apply-sponge-implicit-wildcards=true
|
||||
|
||||
# If the plugin should apply Sponge default subject permissions.
|
||||
# Plugins can manipulate a set of default permissions granted to all users. If this option is set to
|
||||
# false, LuckPerms will ignore this data when considering if a player has a permission.
|
||||
|
@ -33,6 +33,7 @@ import me.lucko.luckperms.common.calculator.PermissionCalculator;
|
||||
import me.lucko.luckperms.common.calculator.processor.MapProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.RegexProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.SpongeWildcardProcessor;
|
||||
import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
||||
@ -60,6 +61,10 @@ public class VelocityCalculatorFactory implements CalculatorFactory {
|
||||
processors.add(new WildcardProcessor());
|
||||
}
|
||||
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS_SPONGE)) {
|
||||
processors.add(new SpongeWildcardProcessor());
|
||||
}
|
||||
|
||||
return new PermissionCalculator(this.plugin, metadata, processors.build());
|
||||
}
|
||||
}
|
||||
|
@ -443,6 +443,14 @@ meta-value-selection:
|
||||
# permissions matching the wildcard.
|
||||
apply-wildcards: true
|
||||
|
||||
# If LuckPerms should resolve and apply permissions according to the Sponge style implicit wildcard
|
||||
# inheritance system.
|
||||
#
|
||||
# - That being: If a user has been granted "example", then the player should have also be
|
||||
# automatically granted "example.function", "example.another", "example.deeper.nesting",
|
||||
# and so on.
|
||||
apply-sponge-implicit-wildcards: false
|
||||
|
||||
# If the plugin should parse regex permissions.
|
||||
#
|
||||
# - If set to true, LuckPerms will detect regex permissions, marked with "r=" at the start of the
|
||||
|
Loading…
Reference in New Issue
Block a user