From 328202f6194c913ba368a7ec7d10ef021da7d380 Mon Sep 17 00:00:00 2001 From: sauilitired Date: Tue, 14 Jul 2015 01:54:52 +0200 Subject: [PATCH] Fixes --- .../plot/commands/list.java | 62 +++++++++++++++---- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java index d408d4937..96f97be40 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -59,21 +59,61 @@ public class list extends SubCommand { } return name; } - - public void noArgs(PlotPlayer plr) { - final StringBuilder builder = new StringBuilder(); - builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s()); - if (plr != null) { + + private String[] getArgumentList(PlotPlayer player) { + List args = new ArrayList<>(); + if (player == null) { + args.addAll(Arrays.asList("world", "all", "unowned", "unknown", "top", "")); if (EconHandler.manager != null) { - builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "unowned", "unknown", "top", "", "", "forsale",})); - } - else { - builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "unowned", "unknown", "top", "", ""})); + args.add("forsale"); } } else { - builder.append(getArgumentList(new String[] { "world", "all", "unowned", "unknown", "top", "", ""})); + if (EconHandler.manager != null && player.hasPermission("plots.list.forsale")) { + args.add("forsale"); + } + if (player.hasPermission("plots.list.mine")) { + args.add("mine"); + } + if (player.hasPermission("plots.list.shared")) { + args.add("shared"); + } + if (player.hasPermission("plots.list.world")) { + args.add("world"); + } + if (player.hasPermission("plots.list.top")) { + args.add("top"); + } + if (player.hasPermission("plots.list..all")) { + args.add("all"); + } + if (player.hasPermission("plots.list.unowned")) { + args.add("unowned"); + } + if (player.hasPermission("plots.list.unknown")) { + args.add("unknown"); + } + if (player.hasPermission("plots.list.player")) { + args.add(""); + } + if (player.hasPermission("plots.list.world")) { + args.add(""); + } } - MainUtil.sendMessage(plr, builder.toString()); + return args.toArray(new String[args.size()]); + } + + public void noArgs(PlotPlayer plr) { + // if (plr != null) { + // if (EconHandler.manager != null) { + // builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "unowned", "unknown", "top", "", "", "forsale",})); + // } + // else { + // builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "unowned", "unknown", "top", "", ""})); + // } + // } else { + // builder.append(getArgumentList(new String[] { "world", "all", "unowned", "unknown", "top", "", ""})); + // } + MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(getArgumentList(plr))); } @Override