diff --git a/PlotSquared/src/com/intellectualcrafters/plot/FlagManager.java b/PlotSquared/src/com/intellectualcrafters/plot/FlagManager.java index 08a656b51..d6b9da38e 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/FlagManager.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/FlagManager.java @@ -1,5 +1,7 @@ package com.intellectualcrafters.plot; +import org.bukkit.entity.Player; + import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -57,6 +59,20 @@ public class FlagManager { return flags; } + /** + * Get a list of registerd AbstragFlag objects based on player permissions + * @param player with permissions + * @return List (AbstractFlag) + */ + public static List getFlags(Player player) { + List returnFlags = new ArrayList<>(); + for(AbstractFlag flag : flags) { + if(player.hasPermission("plots.set." + flag.getKey().toLowerCase())) + returnFlags.add(flag); + } + return returnFlags; + } + /** * Get an AbstractFlag by a string Returns null if flag does not exist * diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java index 73617c98f..52139d7c3 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java @@ -78,7 +78,7 @@ public class Set extends SubCommand { if (args[0].equalsIgnoreCase("flag")) { if (args.length < 2) { - String message = StringUtils.join(FlagManager.getFlags(), "&c, &6"); + String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6"); if (PlotMain.worldGuardListener != null) { if (message.equals("")) { message = StringUtils.join(PlotMain.worldGuardListener.str_flags, "&c, &6");