Implement (partially) clickable permission lists - towards #68

This commit is contained in:
Luck 2016-12-12 18:56:48 +00:00
parent 22ccce3208
commit 21135dac07
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
32 changed files with 100 additions and 32 deletions

View File

@ -122,7 +122,7 @@ public class SharedMainCommand<T extends PermissionHolder> extends SubCommand<T>
CommandResult result; CommandResult result;
try { try {
result = sub.execute(plugin, sender, t, strippedArgs); result = sub.execute(plugin, sender, t, strippedArgs, label);
} catch (CommandException e) { } catch (CommandException e) {
result = handleException(e, sender, sub); result = handleException(e, sender, sub);
} }

View File

@ -82,7 +82,7 @@ public abstract class SharedSubCommand {
private final Predicate<? super Integer> isArgumentInvalid; private final Predicate<? super Integer> isArgumentInvalid;
private final ImmutableList<Arg> args; private final ImmutableList<Arg> args;
public abstract CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException; public abstract CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException;
public List<String> onTabComplete(LuckPermsPlugin plugin, Sender sender, List<String> args) { public List<String> onTabComplete(LuckPermsPlugin plugin, Sender sender, List<String> args) {
return Collections.emptyList(); return Collections.emptyList();

View File

@ -55,7 +55,7 @@ public class MetaAddPrefix extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int priority = ArgumentUtils.handlePriority(0, args); int priority = ArgumentUtils.handlePriority(0, args);
String prefix = ArgumentUtils.handleNodeWithoutCheck(1, args); String prefix = ArgumentUtils.handleNodeWithoutCheck(1, args);
String server = ArgumentUtils.handleServer(2, args); String server = ArgumentUtils.handleServer(2, args);

View File

@ -55,7 +55,7 @@ public class MetaAddSuffix extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int priority = ArgumentUtils.handlePriority(0, args); int priority = ArgumentUtils.handlePriority(0, args);
String suffix = ArgumentUtils.handleNodeWithoutCheck(1, args); String suffix = ArgumentUtils.handleNodeWithoutCheck(1, args);
String server = ArgumentUtils.handleServer(2, args); String server = ArgumentUtils.handleServer(2, args);

View File

@ -57,7 +57,7 @@ public class MetaAddTempPrefix extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int priority = ArgumentUtils.handlePriority(0, args); int priority = ArgumentUtils.handlePriority(0, args);
String prefix = ArgumentUtils.handleNodeWithoutCheck(1, args); String prefix = ArgumentUtils.handleNodeWithoutCheck(1, args);
long duration = ArgumentUtils.handleDuration(2, args); long duration = ArgumentUtils.handleDuration(2, args);

View File

@ -57,7 +57,7 @@ public class MetaAddTempSuffix extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int priority = ArgumentUtils.handlePriority(0, args); int priority = ArgumentUtils.handlePriority(0, args);
String suffix = ArgumentUtils.handleNodeWithoutCheck(1, args); String suffix = ArgumentUtils.handleNodeWithoutCheck(1, args);
long duration = ArgumentUtils.handleDuration(2, args); long duration = ArgumentUtils.handleDuration(2, args);

View File

@ -50,7 +50,7 @@ public class MetaClear extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int before = holder.getNodes().size(); int before = holder.getNodes().size();
String server = ArgumentUtils.handleServer(0, args); String server = ArgumentUtils.handleServer(0, args);

View File

@ -54,7 +54,7 @@ public class MetaInfo extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
SortedSet<Map.Entry<Integer, LocalizedNode>> prefixes = new TreeSet<>(Util.META_COMPARATOR.reversed()); SortedSet<Map.Entry<Integer, LocalizedNode>> prefixes = new TreeSet<>(Util.META_COMPARATOR.reversed());
SortedSet<Map.Entry<Integer, LocalizedNode>> suffixes = new TreeSet<>(Util.META_COMPARATOR.reversed()); SortedSet<Map.Entry<Integer, LocalizedNode>> suffixes = new TreeSet<>(Util.META_COMPARATOR.reversed());
Set<LocalizedNode> meta = new HashSet<>(); Set<LocalizedNode> meta = new HashSet<>();

View File

@ -57,7 +57,7 @@ public class MetaRemovePrefix extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int priority = ArgumentUtils.handlePriority(0, args); int priority = ArgumentUtils.handlePriority(0, args);
String prefix = ArgumentUtils.handleNodeWithoutCheck(1, args); String prefix = ArgumentUtils.handleNodeWithoutCheck(1, args);
String server = ArgumentUtils.handleServer(2, args); String server = ArgumentUtils.handleServer(2, args);

View File

@ -57,7 +57,7 @@ public class MetaRemoveSuffix extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int priority = ArgumentUtils.handlePriority(0, args); int priority = ArgumentUtils.handlePriority(0, args);
String suffix = ArgumentUtils.handleNodeWithoutCheck(1, args); String suffix = ArgumentUtils.handleNodeWithoutCheck(1, args);
String server = ArgumentUtils.handleServer(2, args); String server = ArgumentUtils.handleServer(2, args);

View File

@ -56,7 +56,7 @@ public class MetaRemoveTempPrefix extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int priority = ArgumentUtils.handlePriority(0, args); int priority = ArgumentUtils.handlePriority(0, args);
String prefix = ArgumentUtils.handleNodeWithoutCheck(1, args); String prefix = ArgumentUtils.handleNodeWithoutCheck(1, args);
String server = ArgumentUtils.handleServer(2, args); String server = ArgumentUtils.handleServer(2, args);

View File

@ -56,7 +56,7 @@ public class MetaRemoveTempSuffix extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
int priority = ArgumentUtils.handlePriority(0, args); int priority = ArgumentUtils.handlePriority(0, args);
String suffix = ArgumentUtils.handleNodeWithoutCheck(1, args); String suffix = ArgumentUtils.handleNodeWithoutCheck(1, args);
String server = ArgumentUtils.handleServer(2, args); String server = ArgumentUtils.handleServer(2, args);

View File

@ -55,7 +55,7 @@ public class MetaSet extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String key = args.get(0); String key = args.get(0);
String value = args.get(1); String value = args.get(1);

View File

@ -57,7 +57,7 @@ public class MetaSetTemp extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String key = args.get(0); String key = args.get(0);
String value = args.get(1); String value = args.get(1);
long duration = ArgumentUtils.handleDuration(2, args); long duration = ArgumentUtils.handleDuration(2, args);

View File

@ -52,7 +52,7 @@ public class MetaUnset extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String key = args.get(0); String key = args.get(0);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -52,7 +52,7 @@ public class MetaUnsetTemp extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String key = args.get(0); String key = args.get(0);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -56,7 +56,7 @@ public class ParentAdd extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String groupName = ArgumentUtils.handleName(0, args); String groupName = ArgumentUtils.handleName(0, args);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -58,7 +58,7 @@ public class ParentAddTemp extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String groupName = ArgumentUtils.handleName(0, args); String groupName = ArgumentUtils.handleName(0, args);
long duration = ArgumentUtils.handleDuration(1, args); long duration = ArgumentUtils.handleDuration(1, args);
String server = ArgumentUtils.handleServer(2, args); String server = ArgumentUtils.handleServer(2, args);

View File

@ -42,7 +42,7 @@ public class ParentInfo extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
Message.LISTPARENTS.send(sender, holder.getFriendlyName(), Util.permGroupsToString(holder.getPermissions(false))); Message.LISTPARENTS.send(sender, holder.getFriendlyName(), Util.permGroupsToString(holder.getPermissions(false)));
Message.LISTPARENTS_TEMP.send(sender, holder.getFriendlyName(), Util.tempGroupsToString(holder.getPermissions(false))); Message.LISTPARENTS_TEMP.send(sender, holder.getFriendlyName(), Util.tempGroupsToString(holder.getPermissions(false)));
return CommandResult.SUCCESS; return CommandResult.SUCCESS;

View File

@ -56,7 +56,7 @@ public class ParentRemove extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String groupName = ArgumentUtils.handleName(0, args); String groupName = ArgumentUtils.handleName(0, args);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -55,7 +55,7 @@ public class ParentRemoveTemp extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String groupName = ArgumentUtils.handleName(0, args); String groupName = ArgumentUtils.handleName(0, args);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -57,7 +57,7 @@ public class ParentSet extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String groupName = ArgumentUtils.handleName(0, args); String groupName = ArgumentUtils.handleName(0, args);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -53,7 +53,7 @@ public class PermissionCheck extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String node = ArgumentUtils.handleNodeWithoutCheck(0, args); String node = ArgumentUtils.handleNodeWithoutCheck(0, args);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -54,7 +54,7 @@ public class PermissionCheckInherits extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String node = ArgumentUtils.handleNodeWithoutCheck(0, args); String node = ArgumentUtils.handleNodeWithoutCheck(0, args);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -41,8 +41,9 @@ public class PermissionInfo extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
Message.LISTNODES.send(sender, holder.getFriendlyName(), Util.permNodesToString(holder.getPermissions(false))); Message.LISTNODES.send(sender, holder.getFriendlyName());
sender.sendMessage(Util.permNodesToMessage(holder.getPermissions(false), holder, label));
Message.LISTNODES_TEMP.send(sender, holder.getFriendlyName(), Util.tempNodesToString(holder.getPermissions(false))); Message.LISTNODES_TEMP.send(sender, holder.getFriendlyName(), Util.tempNodesToString(holder.getPermissions(false)));
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} }

View File

@ -57,7 +57,7 @@ public class PermissionSet extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String node = ArgumentUtils.handleNode(0, args); String node = ArgumentUtils.handleNode(0, args);
boolean b = ArgumentUtils.handleBoolean(1, args); boolean b = ArgumentUtils.handleBoolean(1, args);

View File

@ -59,7 +59,7 @@ public class PermissionSetTemp extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String node = ArgumentUtils.handleNode(0, args); String node = ArgumentUtils.handleNode(0, args);
boolean b = ArgumentUtils.handleBoolean(1, args); boolean b = ArgumentUtils.handleBoolean(1, args);

View File

@ -53,7 +53,7 @@ public class PermissionUnset extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String node = ArgumentUtils.handleNode(0, args); String node = ArgumentUtils.handleNode(0, args);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -53,7 +53,7 @@ public class PermissionUnsetTemp extends SharedSubCommand {
} }
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args) throws CommandException { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
String node = ArgumentUtils.handleNode(0, args); String node = ArgumentUtils.handleNode(0, args);
String server = ArgumentUtils.handleServer(1, args); String server = ArgumentUtils.handleServer(1, args);
String world = ArgumentUtils.handleWorld(2, args); String world = ArgumentUtils.handleWorld(2, args);

View File

@ -57,7 +57,7 @@ public class ExportCommand extends SingleCommand {
} }
} }
private static String nodeToString(Node node, String id, boolean group) { public static String nodeToString(Node node, String id, boolean group) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("/luckperms ").append(group ? "group " : "user ").append(id).append(" "); sb.append("/luckperms ").append(group ? "group " : "user ").append(id).append(" ");

View File

@ -27,11 +27,17 @@ import lombok.experimental.UtilityClass;
import me.lucko.luckperms.api.LocalizedNode; import me.lucko.luckperms.api.LocalizedNode;
import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.Tristate; import me.lucko.luckperms.api.Tristate;
import me.lucko.luckperms.common.commands.misc.ExportCommand;
import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.sender.Sender;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Patterns; import me.lucko.luckperms.common.constants.Patterns;
import me.lucko.luckperms.common.core.model.PermissionHolder;
import me.lucko.luckperms.common.core.model.User;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import io.github.mkremins.fanciful.ChatColor;
import io.github.mkremins.fanciful.FancyMessage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@ -124,10 +130,35 @@ public class Util {
return sb.toString(); return sb.toString();
} }
public static FancyMessage appendNodeContextDescription(Node node, FancyMessage message) {
if (node.isServerSpecific()) {
message = message.then(" ");
message = appendContext("server", node.getServer().get(), message);
}
if (node.isWorldSpecific()) {
message = message.then(" ");
message = appendContext("world", node.getWorld().get(), message);
}
for (Map.Entry<String, String> c : node.getContexts().toSet()) {
message = message.then(" ");
message = appendContext(c.getKey(), c.getValue(), message);
}
return message;
}
public static String contextToString(String key, String value) { public static String contextToString(String key, String value) {
return "&8(&7" + key + "=&f" + value + "&8)"; return "&8(&7" + key + "=&f" + value + "&8)";
} }
public static FancyMessage appendContext(String key, String value, FancyMessage message) {
return message
.then("(").color(ChatColor.getByChar('8'))
.then(key + "=").color(ChatColor.getByChar('7'))
.then(value).color(ChatColor.getByChar('f'))
.then(")").color(ChatColor.getByChar('8'));
}
public static String permNodesToString(SortedSet<LocalizedNode> nodes) { public static String permNodesToString(SortedSet<LocalizedNode> nodes) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (Node node : nodes) { for (Node node : nodes) {
@ -142,6 +173,42 @@ public class Util {
return sb.length() == 0 ? "&3None" : sb.toString(); return sb.length() == 0 ? "&3None" : sb.toString();
} }
private static FancyMessage makeFancy(PermissionHolder holder, String label, Node node, FancyMessage message) {
message = message.formattedTooltip(
new FancyMessage("> ")
.color(ChatColor.getByChar('3'))
.then(node.getPermission())
.color(node.getValue() ? ChatColor.getByChar('a') : ChatColor.getByChar('c')),
new FancyMessage(" "),
new FancyMessage("Click to remove this node from " + holder.getFriendlyName()).color(ChatColor.getByChar('7'))
);
boolean group = !(holder instanceof User);
String command = ExportCommand.nodeToString(node, group ? holder.getObjectName() : holder.getFriendlyName(), group)
.replace("/luckperms", "/" + label)
.replace("set", "unset")
.replace(" true", "")
.replace(" false", "");
message = message.suggest(command);
return message;
}
public static FancyMessage permNodesToMessage(SortedSet<LocalizedNode> nodes, PermissionHolder holder, String label) {
FancyMessage message = new FancyMessage("");
boolean found = false;
for (Node node : nodes) {
if (node.isTemporary()) continue;
found = true;
message = makeFancy(holder, label, node, message.then("> ").color(ChatColor.getByChar('3')));
message = makeFancy(holder, label, node, message.then(Util.color(node.getPermission())).color(node.getValue() ? ChatColor.getByChar('a') : ChatColor.getByChar('c')));
message = makeFancy(holder, label, node, appendNodeContextDescription(node, message));
message = message.then("\n");
}
return !found ? new FancyMessage("None").color(ChatColor.getByChar('3')) : message;
}
public static String tempNodesToString(SortedSet<LocalizedNode> nodes) { public static String tempNodesToString(SortedSet<LocalizedNode> nodes) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (Node node : nodes) { for (Node node : nodes) {

View File

@ -160,7 +160,7 @@ public enum Message {
DELETE_TRACK_ERROR("There was an error whilst deleting the track.", true), DELETE_TRACK_ERROR("There was an error whilst deleting the track.", true),
TRACKS_LIST("&aTracks: {0}", true), TRACKS_LIST("&aTracks: {0}", true),
LISTNODES("&b{0}'s Nodes:" + "\n" + "{1}", true), LISTNODES("&b{0}'s Nodes:", true),
LISTNODES_TEMP("&b{0}'s Temporary Nodes:" + "\n" + "{1}", true), LISTNODES_TEMP("&b{0}'s Temporary Nodes:" + "\n" + "{1}", true),
LISTPARENTS("&b{0}'s Parent Groups:" + "\n" + "{1}", true), LISTPARENTS("&b{0}'s Parent Groups:" + "\n" + "{1}", true),
LISTPARENTS_TEMP("&b{0}'s Temporary Parent Groups:" + "\n" + "{1}", true), LISTPARENTS_TEMP("&b{0}'s Temporary Parent Groups:" + "\n" + "{1}", true),