1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-09-03 03:12:46 +02:00

Add config option to disable built-in contexts

This commit is contained in:
Luck
2021-03-01 11:18:21 +00:00
parent bf0ac1a867
commit e7f2a8d713
17 changed files with 197 additions and 59 deletions

View File

@@ -35,6 +35,7 @@ import me.lucko.luckperms.bungee.messaging.BungeeMessagingFactory;
import me.lucko.luckperms.common.api.LuckPermsApiProvider;
import me.lucko.luckperms.common.calculator.CalculatorFactory;
import me.lucko.luckperms.common.command.CommandManager;
import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.config.generic.adapter.ConfigurationAdapter;
import me.lucko.luckperms.common.dependencies.Dependency;
import me.lucko.luckperms.common.event.AbstractEventBus;
@@ -50,6 +51,7 @@ import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.context.DefaultContextKeys;
import net.luckperms.api.query.QueryOptions;
import net.md_5.bungee.api.plugin.Plugin;
@@ -141,11 +143,14 @@ public class LPBungeePlugin extends AbstractLuckPermsPlugin {
protected void setupContextManager() {
this.contextManager = new BungeeContextManager(this);
BungeePlayerCalculator playerCalculator = new BungeePlayerCalculator(this);
this.bootstrap.getProxy().getPluginManager().registerListener(this.bootstrap.getLoader(), playerCalculator);
this.contextManager.registerCalculator(playerCalculator);
Set<String> disabledContexts = getConfiguration().get(ConfigKeys.DISABLED_CONTEXTS);
if (!disabledContexts.contains(DefaultContextKeys.WORLD_KEY)) {
BungeePlayerCalculator playerCalculator = new BungeePlayerCalculator(this);
this.bootstrap.getProxy().getPluginManager().registerListener(this.bootstrap.getLoader(), playerCalculator);
this.contextManager.registerCalculator(playerCalculator);
}
if (this.bootstrap.getProxy().getPluginManager().getPlugin("RedisBungee") != null) {
if (!disabledContexts.contains("proxy") && this.bootstrap.getProxy().getPluginManager().getPlugin("RedisBungee") != null) {
this.contextManager.registerCalculator(new RedisBungeeCalculator());
}
}

View File

@@ -443,6 +443,11 @@ post-traversal-inheritance-sort: false
# entries in A are also in B.
context-satisfy-mode: at-least-one-value-per-key
# LuckPerms has a number of built-in contexts. These can be disabled by adding the context key to
# the list below.
disabled-contexts:
# - "world"
# +----------------------------------------------------------------------------------------------+ #
# | Permission resolution settings | #
# +----------------------------------------------------------------------------------------------+ #