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

74 lines
1.5 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;
2011-07-31 03:17:00 +02:00
2011-10-09 20:10:19 +02:00
public class CmdOwnerList extends FCommand
2011-10-09 18:35:39 +02:00
{
2011-07-31 03:17:00 +02:00
2011-10-09 20:10:19 +02:00
public CmdOwnerList()
2011-10-09 18:35:39 +02:00
{
super();
this.aliases.add("ownerlist");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
2011-10-09 21:57:43 +02:00
this.permission = Permission.OWNERLIST.node;
this.disableOnLock = false;
2011-10-09 18:35:39 +02:00
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
2011-07-31 03:17:00 +02:00
}
@Override
2011-10-09 18:35:39 +02:00
public void perform()
{
boolean hasBypass = fme.isAdminBypassing();
2011-07-31 03:17:00 +02:00
2011-10-09 18:35:39 +02:00
if ( ! hasBypass && ! assertHasFaction())
{
2011-07-31 03:17:00 +02:00
return;
}
2011-10-09 18:35:39 +02:00
if ( ! Conf.ownedAreasEnabled)
{
2011-10-10 13:40:24 +02:00
fme.msg("<b>Owned areas are disabled on this server.");
2011-07-31 03:17:00 +02:00
return;
}
FLocation flocation = new FLocation(fme);
2011-07-31 03:17:00 +02:00
if (Board.getFactionAt(flocation) != myFaction)
2011-10-09 18:35:39 +02:00
{
if (!hasBypass)
{
2011-10-10 13:40:24 +02:00
fme.msg("<b>This land is not claimed by your faction.");
2011-07-31 03:17:00 +02:00
return;
}
myFaction = Board.getFactionAt(flocation);
2011-10-09 18:35:39 +02:00
if (!myFaction.isNormal())
{
2011-10-10 13:40:24 +02:00
fme.msg("<i>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);
2011-10-09 18:35:39 +02:00
if (owners == null || owners.isEmpty())
{
2011-10-10 13:40:24 +02:00
fme.msg("<i>No owners are set here; everyone in the faction has access.");
2011-07-31 03:17:00 +02:00
return;
}
2011-10-10 13:40:24 +02:00
fme.msg("<i>Current owner(s) of this land: %s", owners);
2011-07-31 03:17:00 +02:00
}
}