Print true/false alongside permission info output for consoles without color. Closes #84

This commit is contained in:
Luck 2016-12-16 19:21:36 +00:00
parent 1d8a60749d
commit 4167460d28
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 9 additions and 2 deletions

View File

@ -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;
}

View File

@ -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");
}