2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
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-03-22 15:45:41 +01:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
public class CmdOpen extends FCommand {
|
|
|
|
public CmdOpen() {
|
|
|
|
super();
|
|
|
|
this.aliases.add("open");
|
|
|
|
|
|
|
|
//this.requiredArgs.add("");
|
|
|
|
this.optionalArgs.put("yes/no", "flip");
|
|
|
|
|
|
|
|
this.permission = Permission.OPEN.node;
|
|
|
|
this.disableOnLock = false;
|
|
|
|
|
|
|
|
senderMustBePlayer = true;
|
|
|
|
senderMustBeMember = false;
|
|
|
|
senderMustBeModerator = true;
|
|
|
|
senderMustBeAdmin = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@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
|
|
|
|
if (!payForCommand(Conf.econCostOpen, "to open or close the faction", "for opening or closing the faction"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
faction.msg("<i>The faction %s<i> is now %s", myFaction.getTag(faction), open);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|