added FPerm arg reader.

This commit is contained in:
Olof Larsson 2013-04-16 07:45:20 +02:00
parent 96954e4eb2
commit 4e9d963c67

View File

@ -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<FPerm>
{
// -------------------------------------------- //
// 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<String> altNames(CommandSender sender)
{
List<String> ret = new ArrayList<String>();
for (FPerm fperm : FPerm.values())
{
ret.add(Txt.getNicedEnum(fperm));
}
return ret;
}
}