2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2014-10-15 14:35:50 +02:00
|
|
|
import java.util.TreeSet;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2015-01-10 13:00:29 +01:00
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
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;
|
2015-01-10 13:00:29 +01:00
|
|
|
import com.massivecraft.factions.event.EventFactionsFactionShowAsync;
|
|
|
|
import com.massivecraft.factions.Factions;
|
2013-04-09 12:56:29 +02:00
|
|
|
import com.massivecraft.factions.Perm;
|
2014-10-15 14:35:50 +02:00
|
|
|
import com.massivecraft.massivecore.PriorityLines;
|
2014-06-04 14:02:23 +02:00
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
2015-01-10 13:00:29 +01:00
|
|
|
import com.massivecraft.massivecore.mixin.Mixin;
|
2014-06-04 14:02:23 +02:00
|
|
|
import com.massivecraft.massivecore.util.Txt;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
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
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-26 14:01:28 +02:00
|
|
|
public CmdFactionsFaction()
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// Aliases
|
2013-04-26 14:01:28 +02:00
|
|
|
this.addAliases("f", "faction");
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// Args
|
2013-04-16 10:30:21 +02:00
|
|
|
this.addOptionalArg("faction", "you");
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// Requirements
|
2013-04-26 14:01:28 +02:00
|
|
|
this.addRequirements(ReqHasPerm.get(Perm.FACTION.node));
|
2011-03-23 17:39:56 +01:00
|
|
|
}
|
2011-06-30 12:56:02 +02: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
|
2015-01-10 13:00:29 +01:00
|
|
|
final Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
2013-04-16 11:05:49 +02:00
|
|
|
if (faction == null) return;
|
2013-04-24 11:16:37 +02:00
|
|
|
|
2015-01-10 13:00:29 +01:00
|
|
|
final CommandSender sender = this.sender;
|
2013-04-26 17:54:06 +02:00
|
|
|
|
2015-01-10 13:00:29 +01:00
|
|
|
Bukkit.getScheduler().runTaskAsynchronously(Factions.get(), new Runnable()
|
2014-10-02 11:45:06 +02:00
|
|
|
{
|
2015-01-10 13:00:29 +01:00
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
// Event
|
|
|
|
EventFactionsFactionShowAsync event = new EventFactionsFactionShowAsync(sender, faction);
|
|
|
|
event.run();
|
|
|
|
if (event.isCancelled()) return;
|
|
|
|
|
|
|
|
// Title
|
|
|
|
Mixin.messageOne(sender, Txt.titleize("Faction " + faction.getName(msender)));
|
|
|
|
|
|
|
|
// Lines
|
|
|
|
TreeSet<PriorityLines> priorityLiness = new TreeSet<PriorityLines>(event.getIdPriorityLiness().values());
|
|
|
|
for (PriorityLines priorityLines : priorityLiness)
|
|
|
|
{
|
|
|
|
Mixin.messageOne(sender, priorityLines.getLines());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|