mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-06 10:59:35 +01:00
Print true/false alongside permission info output for consoles without color. Closes #84
This commit is contained in:
parent
1d8a60749d
commit
4167460d28
@ -28,6 +28,7 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.generic.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
@ -43,7 +44,12 @@ public class PermissionInfo extends SharedSubCommand {
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException {
|
||||
Message.LISTNODES.send(sender, holder.getFriendlyName());
|
||||
if (sender.getUuid().equals(Constants.getConsoleUUID())) {
|
||||
sender.sendMessage(Util.color(Util.permNodesToStringConsole(holder.getPermissions(false))));
|
||||
} else {
|
||||
sender.sendMessage(Util.permNodesToMessage(holder.getPermissions(false), holder, label));
|
||||
}
|
||||
|
||||
Message.LISTNODES_TEMP.send(sender, holder.getFriendlyName(), Util.tempNodesToString(holder.getPermissions(false)));
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class Util {
|
||||
.then(")").color(ChatColor.getByChar('8'));
|
||||
}
|
||||
|
||||
public static String permNodesToString(SortedSet<LocalizedNode> nodes) {
|
||||
public static String permNodesToStringConsole(SortedSet<LocalizedNode> nodes) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Node node : nodes) {
|
||||
if (node.isTemporary()) continue;
|
||||
@ -167,6 +167,7 @@ public class Util {
|
||||
sb.append("&3> ")
|
||||
.append(node.getValue() ? "&a" : "&c")
|
||||
.append(node.getPermission())
|
||||
.append(" ").append("&7(").append(node.getValue()).append("&7)")
|
||||
.append(getNodeContextDescription(node))
|
||||
.append("\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user