2015-01-09 22:36:12 +01:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2015-05-06 17:04:35 +02:00
|
|
|
import java.util.Collection;
|
2015-01-09 22:36:12 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Perm;
|
|
|
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
|
|
|
import com.massivecraft.factions.cmd.arg.ARMFlag;
|
|
|
|
import com.massivecraft.factions.entity.Faction;
|
|
|
|
import com.massivecraft.factions.entity.MFlag;
|
2015-02-12 12:00:55 +01:00
|
|
|
import com.massivecraft.massivecore.MassiveException;
|
2015-05-06 17:04:35 +02:00
|
|
|
import com.massivecraft.massivecore.cmd.arg.ARAll;
|
|
|
|
import com.massivecraft.massivecore.cmd.arg.ARSet;
|
2015-01-09 22:36:12 +01:00
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
|
|
|
import com.massivecraft.massivecore.util.Txt;
|
|
|
|
|
|
|
|
public class CmdFactionsFlagShow extends FactionsCommand
|
|
|
|
{
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
public CmdFactionsFlagShow()
|
|
|
|
{
|
|
|
|
// Aliases
|
|
|
|
this.addAliases("s", "show");
|
|
|
|
|
|
|
|
// Args
|
2015-05-06 17:04:35 +02:00
|
|
|
this.addArg(ARFaction.get(), "faction", "you");
|
|
|
|
this.addArg(ARAll.get(ARSet.get(ARMFlag.get(), false)), "flags", "all", true);
|
2015-01-09 22:36:12 +01:00
|
|
|
|
|
|
|
// Requirements
|
|
|
|
this.addRequirements(ReqHasPerm.get(Perm.FLAG_SHOW.node));
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
@Override
|
2015-02-12 12:00:55 +01:00
|
|
|
public void perform() throws MassiveException
|
2015-01-09 22:36:12 +01:00
|
|
|
{
|
|
|
|
// Arg: Faction
|
2015-05-06 17:04:35 +02:00
|
|
|
Faction faction = this.readArg(msenderFaction);
|
|
|
|
Collection<MFlag> mflags = this.readArg(MFlag.getAll());
|
2015-01-09 22:36:12 +01:00
|
|
|
|
|
|
|
// Create messages
|
|
|
|
List<String> messages = new ArrayList<String>();
|
|
|
|
messages.add(Txt.titleize("Flag for " + faction.describeTo(msender, true)));
|
2015-05-06 17:04:35 +02:00
|
|
|
for (MFlag mflag : mflags)
|
2015-01-09 22:36:12 +01:00
|
|
|
{
|
|
|
|
messages.add(mflag.getStateDesc(faction.getFlag(mflag), true, true, true, true, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Send messages
|
|
|
|
sendMessage(messages);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|