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

50 lines
1.3 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2013-04-09 13:15:25 +02:00
import com.massivecraft.factions.ConfServer;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Faction;
2013-04-09 12:58:39 +02:00
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.Perm;
2011-10-09 20:10:19 +02:00
public class CmdOpen extends FCommand
2011-10-09 18:35:39 +02:00
{
2011-10-09 20:10:19 +02:00
public CmdOpen()
2011-10-09 18:35:39 +02:00
{
super();
this.aliases.add("open");
//this.requiredArgs.add("");
2011-10-15 19:46:44 +02:00
this.optionalArgs.put("yes/no", "flip");
this.permission = Perm.OPEN.node;
2011-10-09 21:57:43 +02:00
this.disableOnLock = false;
2011-10-09 18:35:39 +02:00
senderMustBePlayer = true;
senderMustBeMember = false;
2011-10-23 17:55:53 +02:00
senderMustBeOfficer = true;
senderMustBeLeader = false;
}
@Override
2011-10-09 18:35:39 +02:00
public void perform()
{
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
2013-04-09 13:15:25 +02:00
if ( ! payForCommand(ConfServer.econCostOpen, "to open or close the faction", "for opening or closing the faction")) return;
2011-10-09 18:35:39 +02:00
myFaction.setOpen(this.argAsBool(0, ! myFaction.getOpen()));
String open = myFaction.getOpen() ? "open" : "closed";
// Inform
2011-10-21 19:20:33 +02:00
myFaction.msg("%s<i> changed the faction to <h>%s<i>.", fme.describeTo(myFaction, true), open);
2013-04-09 12:58:39 +02:00
for (Faction faction : FactionColl.i.get())
2011-10-09 18:35:39 +02:00
{
if (faction == myFaction)
{
continue;
}
2011-10-10 13:40:24 +02:00
faction.msg("<i>The faction %s<i> is now %s", myFaction.getTag(faction), open);
}
}
}