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

49 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 {
2014-04-04 20:55:21 +02:00
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
if (!payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
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() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
2014-04-04 20:55:21 +02:00
// Inform
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fplayer.getFactionId().equals(myFaction.getId())) {
fplayer.msg(TL.COMMAND_OPEN_CHANGES, fme.getName(), open);
2014-04-04 20:55:21 +02:00
continue;
2014-07-01 22:10:18 +02:00
}
fplayer.msg(TL.COMMAND_OPEN_CHANGED, myFaction.getTag(fplayer.getFaction()), open);
2014-04-04 20:55:21 +02:00
}
}
}