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

60 lines
1.4 KiB
Java
Raw Normal View History

2011-07-31 03:17:00 +02:00
package com.massivecraft.factions.commands;
import java.util.Set;
import java.util.Iterator;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
2011-07-31 03:17:00 +02:00
2011-10-08 23:22:02 +02:00
public class FCommandOwnerList extends FCommand {
2011-07-31 03:17:00 +02:00
public FCommandOwnerList() {
aliases.add("ownerlist");
helpDescription = "list owner(s) of this claimed land";
}
@Override
public void perform() {
boolean hasBypass = P.hasPermAdminBypass(fme);
2011-07-31 03:17:00 +02:00
if ( ! hasBypass && ! assertHasFaction()) {
return;
}
if ( ! Conf.ownedAreasEnabled) {
fme.sendMessage("Owned areas are disabled on this server.");
2011-07-31 03:17:00 +02:00
return;
}
Faction myFaction = fme.getFaction();
FLocation flocation = new FLocation(fme);
2011-07-31 03:17:00 +02:00
if (Board.getIdAt(flocation) != myFaction.getId()) {
if (!hasBypass) {
fme.sendMessage("This land is not claimed by your faction.");
2011-07-31 03:17:00 +02:00
return;
}
myFaction = Board.getFactionAt(flocation);
if (!myFaction.isNormal()) {
fme.sendMessage("This land is not claimed by any faction, thus no owners.");
2011-07-31 03:17:00 +02:00
return;
}
}
String owners = myFaction.getOwnerListString(flocation);
if (owners == null || owners.isEmpty()) {
fme.sendMessage("No owners are set here; everyone in the faction has access.");
2011-07-31 03:17:00 +02:00
return;
}
fme.sendMessage("Current owner(s) of this land: "+owners);
2011-07-31 03:17:00 +02:00
}
}