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

50 lines
1.2 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
2011-10-09 18:35:39 +02:00
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission;
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("");
this.optionalArgs.put("yes/no", "flipp");
2011-10-09 21:57:43 +02:00
this.permission = Permission.OPEN.node;
this.disableOnLock = false;
2011-10-09 18:35:39 +02:00
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = 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
2011-10-09 18:35:39 +02:00
if ( ! payForCommand(Conf.econCostOpen)) 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-10 13:40:24 +02:00
myFaction.msg("%s<i> changed the faction to <h>%s<i>.", fme.getNameAndRelevant(myFaction), open);
2011-10-09 18:35:39 +02:00
for (Faction faction : Factions.i.get())
{
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);
}
}
}