From 4e9d963c67c6f248f2879a4ca5e0a56e11c27f9d Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 16 Apr 2013 07:45:20 +0200 Subject: [PATCH] added FPerm arg reader. --- .../factions/cmd/arg/ARFPerm.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/com/massivecraft/factions/cmd/arg/ARFPerm.java diff --git a/src/com/massivecraft/factions/cmd/arg/ARFPerm.java b/src/com/massivecraft/factions/cmd/arg/ARFPerm.java new file mode 100644 index 00000000..7f9485e7 --- /dev/null +++ b/src/com/massivecraft/factions/cmd/arg/ARFPerm.java @@ -0,0 +1,51 @@ +package com.massivecraft.factions.cmd.arg; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.bukkit.command.CommandSender; + +import com.massivecraft.factions.FPerm; +import com.massivecraft.mcore.cmd.arg.ARAbstractSelect; +import com.massivecraft.mcore.util.Txt; + +public class ARFPerm extends ARAbstractSelect +{ + // -------------------------------------------- // + // INSTANCE & CONSTRUCT + // -------------------------------------------- // + + private static ARFPerm i = new ARFPerm(); + public static ARFPerm get() { return i; } + + // -------------------------------------------- // + // OVERRIDE + // -------------------------------------------- // + + @Override + public String typename() + { + return "faction permission"; + } + + @Override + public FPerm select(String str, CommandSender sender) + { + return FPerm.parse(str); + } + + @Override + public Collection altNames(CommandSender sender) + { + List ret = new ArrayList(); + + for (FPerm fperm : FPerm.values()) + { + ret.add(Txt.getNicedEnum(fperm)); + } + + return ret; + } + +}