Final bits of API refactoring, add group data caches, fix issue with LPPermissionAttachment fake map injection
This commit is contained in:
@@ -54,16 +54,16 @@ public class BungeeConfigAdapter implements ConfigurationAdapter {
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private File makeFile(String file) throws IOException {
|
||||
File cfg = new File(plugin.getDataFolder(), file);
|
||||
File configFile = new File(plugin.getDataFolder(), file);
|
||||
|
||||
if (!cfg.exists()) {
|
||||
if (!configFile.exists()) {
|
||||
plugin.getDataFolder().mkdir();
|
||||
try (InputStream is = plugin.getResourceAsStream(file)) {
|
||||
Files.copy(is, cfg.toPath());
|
||||
Files.copy(is, configFile.toPath());
|
||||
}
|
||||
}
|
||||
|
||||
return cfg;
|
||||
return configFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-4
@@ -35,7 +35,6 @@ import me.lucko.luckperms.common.calculators.AbstractCalculatorFactory;
|
||||
import me.lucko.luckperms.common.calculators.PermissionCalculator;
|
||||
import me.lucko.luckperms.common.calculators.PermissionCalculatorMetadata;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.processors.MapProcessor;
|
||||
import me.lucko.luckperms.common.processors.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.processors.RegexProcessor;
|
||||
@@ -48,7 +47,7 @@ public class BungeeCalculatorFactory extends AbstractCalculatorFactory {
|
||||
private final LPBungeePlugin plugin;
|
||||
|
||||
@Override
|
||||
public PermissionCalculator build(Contexts contexts, User user) {
|
||||
public PermissionCalculator build(Contexts contexts, PermissionCalculatorMetadata metadata) {
|
||||
ImmutableList.Builder<PermissionProcessor> processors = ImmutableList.builder();
|
||||
|
||||
processors.add(new MapProcessor());
|
||||
@@ -61,8 +60,7 @@ public class BungeeCalculatorFactory extends AbstractCalculatorFactory {
|
||||
processors.add(new WildcardProcessor());
|
||||
}
|
||||
|
||||
PermissionCalculatorMetadata meta = PermissionCalculatorMetadata.of(user.getFriendlyName(), contexts.getContexts());
|
||||
return registerCalculator(new PermissionCalculator(plugin, meta, processors.build()));
|
||||
return registerCalculator(new PermissionCalculator(plugin, metadata, processors.build()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ public class BungeePermissionCheckListener implements Listener {
|
||||
}
|
||||
|
||||
Contexts contexts = plugin.getContextManager().getApplicableContexts(player);
|
||||
Tristate result = user.getUserData().getPermissionData(contexts).getPermissionValue(e.getPermission(), CheckOrigin.PLATFORM_PERMISSION_CHECK);
|
||||
Tristate result = user.getCachedData().getPermissionData(contexts).getPermissionValue(e.getPermission(), CheckOrigin.PLATFORM_PERMISSION_CHECK);
|
||||
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
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class BungeePermissionCheckListener implements Listener {
|
||||
}
|
||||
|
||||
Contexts contexts = plugin.getContextManager().getApplicableContexts(player);
|
||||
Tristate result = user.getUserData().getPermissionData(contexts).getPermissionValue(e.getPermission(), CheckOrigin.PLATFORM_LOOKUP_CHECK);
|
||||
Tristate result = user.getCachedData().getPermissionData(contexts).getPermissionValue(e.getPermission(), CheckOrigin.PLATFORM_LOOKUP_CHECK);
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user