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

56 lines
1.5 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.FPlayer;
import com.massivecraft.factions.FPlayers;
2011-10-09 18:35:39 +02:00
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
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 = false;
senderMustBeColeader = 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, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
return;
}
myFaction.setOpen(this.argAsBool(0, !myFaction.getOpen()));
String open = myFaction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
// Inform
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fplayer.getFactionId().equals(myFaction.getId())) {
fplayer.msg(TL.COMMAND_OPEN_CHANGES, fme.getName(), open);
continue;
}
fplayer.msg(TL.COMMAND_OPEN_CHANGED, myFaction.getTag(fplayer.getFaction()), open);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_OPEN_DESCRIPTION;
}
}