Saber-Factions/src/com/massivecraft/factions/commands/CmdOpen.java

55 lines
1.3 KiB
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions.commands;
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 18:35:39 +02:00
this.permission = Permission.COMMAND_OPEN.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
@Override
2011-10-09 18:35:39 +02:00
public void perform()
{
if( isLocked() )
{
2011-10-09 18:35:39 +02:00
sendLockMessage();
return;
}
// 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-09 18:35:39 +02:00
myFaction.sendMessageParsed("%s<i> changed the faction to ", fme.getNameAndRelevant(myFaction));
for (Faction faction : Factions.i.get())
{
if (faction == myFaction)
{
continue;
}
2011-10-09 18:35:39 +02:00
faction.sendMessageParsed("<i>The faction %s<i> is now %s", myFaction.getTag(faction), open);
}
}
}