Factions/src/com/massivecraft/factions/cmd/CmdFactionsFlagList.java

55 lines
1.3 KiB
Java
Raw Normal View History

package com.massivecraft.factions.cmd;
import java.util.ArrayList;
import java.util.List;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.MFlag;
2015-02-12 12:00:55 +01:00
import com.massivecraft.massivecore.MassiveException;
2015-05-13 23:00:53 +02:00
import com.massivecraft.massivecore.cmd.ArgSetting;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsFlagList extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsFlagList()
{
// Aliases
this.addAliases("l", "list");
// Args
2015-05-13 23:00:53 +02:00
this.addArg(ArgSetting.getPage());
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.FLAG_LIST.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
2015-02-12 12:00:55 +01:00
public void perform() throws MassiveException
{
// Args
2015-05-13 23:00:53 +02:00
int page = this.readArg();
//Create messages
List<String> messages = new ArrayList<String>();
for (MFlag flag : MFlag.getAll())
{
if ( ! flag.isVisible() && ! msender.isUsingAdminMode()) continue;
messages.add(flag.getStateDesc(false, false, true, true, true, false));
}
//Send messages
2015-05-13 23:00:53 +02:00
sendMessage(Txt.getPage(messages, page, "Available Faction Flags", sender));
}
}