Saber-Factions/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java

47 lines
1.4 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;
2014-04-04 20:55:21 +02:00
public class CmdOpen extends FCommand {
public CmdOpen() {
2014-07-01 22:10:18 +02:00
super();
this.aliases.add("open");
2014-04-04 20:55:21 +02:00
//this.requiredArgs.add("");
this.optionalArgs.put("yes/no", "flip");
2014-07-01 22:10:18 +02:00
this.permission = Permission.OPEN.node;
this.disableOnLock = false;
2014-04-04 20:55:21 +02:00
2014-07-01 22:10:18 +02:00
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
2014-04-04 20:55:21 +02:00
}
@Override
public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
2014-07-01 21:49:42 +02:00
if (!payForCommand(Conf.econCostOpen, "to open or close the faction", "for opening or closing the faction")) {
2014-04-04 20:55:21 +02:00
return;
2014-07-01 21:49:42 +02:00
}
2014-04-04 20:55:21 +02:00
myFaction.setOpen(this.argAsBool(0, !myFaction.getOpen()));
String open = myFaction.getOpen() ? "open" : "closed";
// Inform
myFaction.msg("%s<i> changed the faction to <h>%s<i>.", fme.describeTo(myFaction, true), open);
for (Faction faction : Factions.i.get()) {
if (faction == myFaction) {
continue;
2014-07-01 22:10:18 +02:00
}
faction.msg("<i>The faction %s<i> is now %s", myFaction.getTag(faction), open);
2014-04-04 20:55:21 +02:00
}
}
}