From 4167460d28eb7140a7569b7616edb46d4b95260f Mon Sep 17 00:00:00 2001 From: Luck Date: Fri, 16 Dec 2016 19:21:36 +0000 Subject: [PATCH] Print true/false alongside permission info output for consoles without color. Closes #84 --- .../commands/generic/permission/PermissionInfo.java | 8 +++++++- .../me/lucko/luckperms/common/commands/utils/Util.java | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java index 6083f649..7ef925a2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java @@ -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 args, String label) throws CommandException { Message.LISTNODES.send(sender, holder.getFriendlyName()); - sender.sendMessage(Util.permNodesToMessage(holder.getPermissions(false), holder, label)); + 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; } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/utils/Util.java b/common/src/main/java/me/lucko/luckperms/common/commands/utils/Util.java index 60559273..39a3cc35 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/utils/Util.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/utils/Util.java @@ -159,7 +159,7 @@ public class Util { .then(")").color(ChatColor.getByChar('8')); } - public static String permNodesToString(SortedSet nodes) { + public static String permNodesToStringConsole(SortedSet 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"); }