mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-25 23:54:27 +00:00
Add config options to allow for finer control over how permissions are calculated, and set include-global to true on BungeeCord by default
This commit is contained in:
9 files changed
+88
-13
No files matched your search
@@ -46,10 +46,13 @@ public class BungeeCalculatorFactory extends AbstractCalculatorFactory {
|
||||
@Override
|
||||
public PermissionCalculator build(Contexts contexts, User user) {
|
||||
ImmutableList.Builder<PermissionProcessor> processors = ImmutableList.builder();
|
||||
|
||||
processors.add(new MapProcessor());
|
||||
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLYING_REGEX)) {
|
||||
processors.add(new RegexProcessor());
|
||||
}
|
||||
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS)) {
|
||||
processors.add(new WildcardProcessor());
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ package me.lucko.luckperms.bungee;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import me.lucko.luckperms.api.Contexts;
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
@@ -161,6 +162,7 @@ public class BungeeListener implements Listener {
|
||||
|
||||
User user = plugin.getUserManager().get(plugin.getUuidCache().getUUID(player.getUniqueId()));
|
||||
if (user == null) {
|
||||
e.setHasPermission(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,6 +170,7 @@ public class BungeeListener implements Listener {
|
||||
if (userData == null) {
|
||||
plugin.getLog().warn("Player " + player.getName() + " does not have any user data setup.");
|
||||
plugin.doAsync(() -> user.setupData(false));
|
||||
e.setHasPermission(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -181,7 +184,12 @@ public class BungeeListener implements Listener {
|
||||
false
|
||||
);
|
||||
|
||||
e.setHasPermission(userData.getPermissionData(contexts).getPermissionValue(e.getPermission()).asBoolean());
|
||||
Tristate result = userData.getPermissionData(contexts).getPermissionValue(e.getPermission());
|
||||
if (result == Tristate.UNDEFINED && plugin.getConfiguration().get(ConfigKeys.APPLY_BUNGEE_CONFIG_PERMISSIONS)) {
|
||||
return; // just use the result provided by the proxy when the event was created
|
||||
}
|
||||
|
||||
e.setHasPermission(result.asBoolean());
|
||||
}
|
||||
|
||||
// We don't pre-process all servers, so we have to do it here.
|
||||
|
||||
Reference in new issue
Block a user