Add /lp debug command
This commit is contained in:
@@ -121,6 +121,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* LuckPerms implementation for the Sponge API.
|
||||
*/
|
||||
@@ -422,6 +424,7 @@ public class LPSpongePlugin implements LuckPermsSpongePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Contexts getContextForUser(User user) {
|
||||
Player player = getPlayer(user);
|
||||
|
||||
-13
@@ -42,8 +42,6 @@ import me.lucko.luckperms.sponge.processors.GroupDefaultsProcessor;
|
||||
import me.lucko.luckperms.sponge.processors.SpongeWildcardProcessor;
|
||||
import me.lucko.luckperms.sponge.processors.UserDefaultsProcessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SpongeCalculatorFactory extends AbstractCalculatorFactory {
|
||||
private final LPSpongePlugin plugin;
|
||||
|
||||
@@ -79,15 +77,4 @@ public class SpongeCalculatorFactory extends AbstractCalculatorFactory {
|
||||
|
||||
return registerCalculator(new PermissionCalculator(this.plugin, metadata, processors.build()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getActiveProcessors() {
|
||||
ImmutableList.Builder<String> ret = ImmutableList.builder();
|
||||
ret.add("Map");
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLY_SPONGE_IMPLICIT_WILDCARDS)) ret.add("SpongeWildcard");
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLYING_REGEX)) ret.add("Regex");
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS)) ret.add("Wildcard");
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLY_SPONGE_DEFAULT_SUBJECTS)) ret.add("Defaults");
|
||||
return ret.build();
|
||||
}
|
||||
}
|
||||
|
||||
+7
-13
@@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.service.calculated;
|
||||
|
||||
import com.github.benmanes.caffeine.cache.CacheLoader;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -57,8 +56,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* In-memory implementation of {@link LPSubjectData}.
|
||||
*/
|
||||
@@ -75,18 +72,15 @@ public class CalculatedSubjectData implements LPSubjectData {
|
||||
|
||||
private final LoadingCache<ImmutableContextSet, CalculatorHolder> permissionCache = Caffeine.newBuilder()
|
||||
.expireAfterAccess(10, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<ImmutableContextSet, CalculatorHolder>() {
|
||||
@Override
|
||||
public CalculatorHolder load(@Nonnull ImmutableContextSet contexts) {
|
||||
ImmutableList.Builder<PermissionProcessor> processors = ImmutableList.builder();
|
||||
processors.add(new MapProcessor());
|
||||
processors.add(new SpongeWildcardProcessor());
|
||||
.build(contexts -> {
|
||||
ImmutableList.Builder<PermissionProcessor> processors = ImmutableList.builder();
|
||||
processors.add(new MapProcessor());
|
||||
processors.add(new SpongeWildcardProcessor());
|
||||
|
||||
CalculatorHolder holder = new CalculatorHolder(new PermissionCalculator(CalculatedSubjectData.this.service.getPlugin(), PermissionCalculatorMetadata.of(HolderType.GROUP, CalculatedSubjectData.this.calculatorDisplayName, contexts), processors.build()));
|
||||
holder.setPermissions(flattenMap(getRelevantEntries(contexts, CalculatedSubjectData.this.permissions)));
|
||||
CalculatorHolder holder = new CalculatorHolder(new PermissionCalculator(CalculatedSubjectData.this.service.getPlugin(), PermissionCalculatorMetadata.of(HolderType.GROUP, CalculatedSubjectData.this.calculatorDisplayName, contexts), processors.build()));
|
||||
holder.setPermissions(flattenMap(getRelevantEntries(contexts, CalculatedSubjectData.this.permissions)));
|
||||
|
||||
return holder;
|
||||
}
|
||||
return holder;
|
||||
});
|
||||
|
||||
public CalculatedSubjectData(LPSubject parentSubject, LPPermissionService service, String calculatorDisplayName) {
|
||||
|
||||
Reference in New Issue
Block a user