Register Sponge PermDescriptions to the LP permission registry
This commit is contained in:
+1
-1
@@ -100,7 +100,7 @@ public class PermissionCalculator implements CacheLoader<String, Tristate> {
|
||||
// offer the permission to the permission vault
|
||||
// we only need to do this once per permission, so it doesn't matter
|
||||
// that this call is behind the cache.
|
||||
this.plugin.getPermissionVault().offer(permission);
|
||||
this.plugin.getPermissionRegistry().offer(permission);
|
||||
|
||||
for (PermissionProcessor processor : this.processors) {
|
||||
Tristate result = processor.hasPermission(permission);
|
||||
|
||||
@@ -28,7 +28,7 @@ package me.lucko.luckperms.common.command.utils;
|
||||
import com.google.common.base.Splitter;
|
||||
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||
import me.lucko.luckperms.common.treeview.PermissionRegistry;
|
||||
import me.lucko.luckperms.common.treeview.TreeNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -59,7 +59,7 @@ public final class TabCompletions {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getPermissionTabComplete(List<String> args, PermissionVault cache) {
|
||||
public static List<String> getPermissionTabComplete(List<String> args, PermissionRegistry cache) {
|
||||
if (args.size() <= 1) {
|
||||
if (args.isEmpty() || args.get(0).equals("")) {
|
||||
return cache.getRootNode().getChildren()
|
||||
|
||||
+1
-1
@@ -72,6 +72,6 @@ public class PermissionCheck extends SharedSubCommand {
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
return getPermissionTabComplete(args, plugin.getPermissionVault());
|
||||
return getPermissionTabComplete(args, plugin.getPermissionRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -77,6 +77,6 @@ public class PermissionCheckInherits extends SharedSubCommand {
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
return getPermissionTabComplete(args, plugin.getPermissionVault());
|
||||
return getPermissionTabComplete(args, plugin.getPermissionRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -99,6 +99,6 @@ public class PermissionSet extends SharedSubCommand {
|
||||
if (!ret.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
return getPermissionTabComplete(args, plugin.getPermissionVault());
|
||||
return getPermissionTabComplete(args, plugin.getPermissionRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -107,6 +107,6 @@ public class PermissionSetTemp extends SharedSubCommand {
|
||||
if (!ret.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
return getPermissionTabComplete(args, plugin.getPermissionVault());
|
||||
return getPermissionTabComplete(args, plugin.getPermissionRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -93,6 +93,6 @@ public class PermissionUnset extends SharedSubCommand {
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
return getPermissionTabComplete(args, plugin.getPermissionVault());
|
||||
return getPermissionTabComplete(args, plugin.getPermissionRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -93,6 +93,6 @@ public class PermissionUnsetTemp extends SharedSubCommand {
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
return getPermissionTabComplete(args, plugin.getPermissionVault());
|
||||
return getPermissionTabComplete(args, plugin.getPermissionRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,6 @@ public class CheckCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
args.remove(0);
|
||||
return TabCompletions.getPermissionTabComplete(args, plugin.getPermissionVault());
|
||||
return TabCompletions.getPermissionTabComplete(args, plugin.getPermissionRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class SearchCommand extends SingleCommand {
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
return TabCompletions.getPermissionTabComplete(args, plugin.getPermissionVault());
|
||||
return TabCompletions.getPermissionTabComplete(args, plugin.getPermissionRegistry());
|
||||
}
|
||||
|
||||
private static <T> void sendResult(Sender sender, List<HeldPermission<T>> results, Function<T, String> lookupFunction, Message headerMessage, HolderType holderType, String label, int page) {
|
||||
|
||||
@@ -83,7 +83,7 @@ public class TreeCommand extends SingleCommand {
|
||||
user = null;
|
||||
}
|
||||
|
||||
TreeView view = new TreeView(plugin.getPermissionVault(), selection);
|
||||
TreeView view = new TreeView(plugin.getPermissionRegistry(), selection);
|
||||
if (!view.hasData()) {
|
||||
Message.TREE_EMPTY.send(sender);
|
||||
return CommandResult.FAILURE;
|
||||
|
||||
@@ -56,7 +56,7 @@ import me.lucko.luckperms.common.storage.StorageFactory;
|
||||
import me.lucko.luckperms.common.storage.StorageType;
|
||||
import me.lucko.luckperms.common.storage.dao.file.FileWatcher;
|
||||
import me.lucko.luckperms.common.tasks.UpdateTask;
|
||||
import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||
import me.lucko.luckperms.common.treeview.PermissionRegistry;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
|
||||
import java.io.File;
|
||||
@@ -71,7 +71,7 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
||||
|
||||
// init during enable
|
||||
private VerboseHandler verboseHandler;
|
||||
private PermissionVault permissionVault;
|
||||
private PermissionRegistry permissionRegistry;
|
||||
private LogDispatcher logDispatcher;
|
||||
private LuckPermsConfiguration configuration;
|
||||
private LocaleManager localeManager;
|
||||
@@ -104,7 +104,7 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
||||
|
||||
// load some utilities early
|
||||
this.verboseHandler = new VerboseHandler();
|
||||
this.permissionVault = new PermissionVault();
|
||||
this.permissionRegistry = new PermissionRegistry();
|
||||
this.logDispatcher = new LogDispatcher(this);
|
||||
|
||||
// load configuration
|
||||
@@ -195,7 +195,7 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
||||
performEarlyDisableTasks();
|
||||
|
||||
// shutdown permission vault and verbose handler tasks
|
||||
this.permissionVault.stop();
|
||||
this.permissionRegistry.stop();
|
||||
this.verboseHandler.stop();
|
||||
|
||||
// remove any hooks into the platform
|
||||
@@ -266,8 +266,8 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionVault getPermissionVault() {
|
||||
return this.permissionVault;
|
||||
public PermissionRegistry getPermissionRegistry() {
|
||||
return this.permissionRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.Storage;
|
||||
import me.lucko.luckperms.common.storage.dao.file.FileWatcher;
|
||||
import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||
import me.lucko.luckperms.common.treeview.PermissionRegistry;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -208,11 +208,11 @@ public interface LuckPermsPlugin {
|
||||
VerboseHandler getVerboseHandler();
|
||||
|
||||
/**
|
||||
* Gets the permission caching instance for the platform.
|
||||
* Gets the permission registry for the platform.
|
||||
*
|
||||
* @return the permission cache instance
|
||||
* @return the permission registry
|
||||
*/
|
||||
PermissionVault getPermissionVault();
|
||||
PermissionRegistry getPermissionRegistry();
|
||||
|
||||
/**
|
||||
* Gets the log dispatcher running on the platform
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* Stores a collection of all permissions known to the platform.
|
||||
*/
|
||||
public class PermissionVault extends RepeatingTask {
|
||||
public class PermissionRegistry extends RepeatingTask {
|
||||
private static final Splitter DOT_SPLIT = Splitter.on('.').omitEmptyStrings();
|
||||
|
||||
// the root node in the tree
|
||||
@@ -55,7 +55,7 @@ public class PermissionVault extends RepeatingTask {
|
||||
// a queue of permission strings to be processed by the tree
|
||||
private final Queue<String> queue;
|
||||
|
||||
public PermissionVault() {
|
||||
public PermissionRegistry() {
|
||||
super(1000, TimeUnit.MILLISECONDS, "luckperms-permission-vault");
|
||||
this.rootNode = new TreeNode();
|
||||
this.knownPermissions = ConcurrentHashMap.newKeySet(3000);
|
||||
@@ -52,7 +52,7 @@ public class TreeView {
|
||||
// the actual tree object
|
||||
private final ImmutableTreeNode view;
|
||||
|
||||
public TreeView(PermissionVault source, String rootPosition) {
|
||||
public TreeView(PermissionRegistry source, String rootPosition) {
|
||||
if (rootPosition.equals("") || rootPosition.equals("*")) {
|
||||
rootPosition = ".";
|
||||
} else if (!rootPosition.equals(".") && rootPosition.endsWith(".")) {
|
||||
@@ -79,7 +79,7 @@ public class TreeView {
|
||||
* @param source the node source
|
||||
* @return the root, if it exists
|
||||
*/
|
||||
private static Optional<TreeNode> findRoot(String rootPosition, PermissionVault source) {
|
||||
private static Optional<TreeNode> findRoot(String rootPosition, PermissionRegistry source) {
|
||||
// get the root of the permission vault
|
||||
TreeNode root = source.getRootNode();
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public final class WebEditor {
|
||||
)
|
||||
.add("knownPermissions", new JArray()
|
||||
.consume(arr -> {
|
||||
for (String perm : plugin.getPermissionVault().rootAsList()) {
|
||||
for (String perm : plugin.getPermissionRegistry().rootAsList()) {
|
||||
arr.add(perm);
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user