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

71 lines
1.9 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2011-07-31 03:17:00 +02:00
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation;
2011-10-09 18:35:39 +02:00
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
2011-07-31 03:17:00 +02:00
2014-04-04 20:55:21 +02:00
public class CmdOwnerList extends FCommand {
public CmdOwnerList() {
2014-07-01 22:10:18 +02:00
super();
this.aliases.add("ownerlist");
2014-04-04 20:55:21 +02:00
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
2014-07-01 22:10:18 +02:00
this.permission = Permission.OWNERLIST.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 = false;
senderMustBeAdmin = false;
2014-04-04 20:55:21 +02:00
}
@Override
public void perform() {
boolean hasBypass = fme.isAdminBypassing();
if (!hasBypass && !assertHasFaction()) {
return;
}
if (!Conf.ownedAreasEnabled) {
fme.msg(TL.COMMAND_OWNERLIST_DISABLED);
2014-07-01 22:10:18 +02:00
return;
2014-04-04 20:55:21 +02:00
}
FLocation flocation = new FLocation(fme);
if (Board.getInstance().getFactionAt(flocation) != myFaction) {
2014-04-04 20:55:21 +02:00
if (!hasBypass) {
fme.msg(TL.COMMAND_OWNERLIST_WRONGFACTION);
2014-07-01 22:10:18 +02:00
return;
2014-04-04 20:55:21 +02:00
}
//TODO: This code won't ever be called.
myFaction = Board.getInstance().getFactionAt(flocation);
2014-07-01 22:10:18 +02:00
if (!myFaction.isNormal()) {
fme.msg(TL.COMMAND_OWNERLIST_NOTCLAIMED);
2014-07-01 22:10:18 +02:00
return;
2014-04-04 20:55:21 +02:00
}
}
String owners = myFaction.getOwnerListString(flocation);
if (owners == null || owners.isEmpty()) {
fme.msg(TL.COMMAND_OWNERLIST_NONE);
2014-07-01 22:10:18 +02:00
return;
2014-04-04 20:55:21 +02:00
}
fme.msg(TL.COMMAND_OWNERLIST_OWNERS, owners);
2014-04-04 20:55:21 +02:00
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_OWNERLIST_DESCRIPTION;
}
2011-07-31 03:17:00 +02:00
}