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

73 lines
1.5 KiB
Java
Raw Normal View History

2011-07-31 03:17:00 +02:00
package com.massivecraft.factions.commands;
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("", "");
this.permission = Permission.COMMAND_OWNERLIST.node;
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)
{
fme.sendMessageParsed("<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
2011-10-09 18:35:39 +02:00
if (Board.getIdAt(flocation) != myFaction.getId())
{
if (!hasBypass)
{
fme.sendMessageParsed("<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())
{
fme.sendMessageParsed("<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())
{
fme.sendMessageParsed("<i>No owners are set here; everyone in the faction has access.");
2011-07-31 03:17:00 +02:00
return;
}
2011-10-09 18:35:39 +02:00
fme.sendMessageParsed("<i>Current owner(s) of this land: %s", owners);
2011-07-31 03:17:00 +02:00
}
}