Factions3/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFaction.java

59 lines
1.5 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
import java.util.TreeSet;
2013-04-16 11:05:49 +02:00
import com.massivecraft.factions.cmd.arg.ARFaction;
2013-04-22 09:37:53 +02:00
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.EventFactionsFactionShow;
import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.PriorityLines;
2014-06-04 14:02:23 +02:00
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
2014-09-18 13:41:20 +02:00
public class CmdFactionsFaction extends FactionsCommand
2011-10-09 18:35:39 +02:00
{
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsFaction()
2011-10-09 18:35:39 +02:00
{
2013-11-11 09:31:04 +01:00
// Aliases
this.addAliases("f", "faction");
2013-11-11 09:31:04 +01:00
// Args
this.addOptionalArg("faction", "you");
2013-11-11 09:31:04 +01:00
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.FACTION.node));
2011-03-23 17:39:56 +01:00
}
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
2011-10-09 18:35:39 +02:00
@Override
public void perform()
{
2013-04-25 16:54:55 +02:00
// Args
2014-09-18 13:41:20 +02:00
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
2013-04-16 11:05:49 +02:00
if (faction == null) return;
// Event
EventFactionsFactionShow event = new EventFactionsFactionShow(sender, faction);
event.run();
if (event.isCancelled()) return;
// Title
2014-09-18 13:41:20 +02:00
msg(Txt.titleize("Faction " + faction.getName(msender)));
2013-04-26 17:54:06 +02:00
// Lines
TreeSet<PriorityLines> priorityLiness = new TreeSet<PriorityLines>(event.getIdPriorityLiness().values());
for (PriorityLines priorityLines : priorityLiness)
{
sendMessage(priorityLines.getLines());
}
}
}