Factions3/src/com/massivecraft/factions/commands/FCommandOwnerList.java
Brettflan 508f953ce9 Faction admins can now mark already claimed areas as owned by specific faction members. Ownership can include multiple members. New command /f owner *[player name], to set/remove ownership. This command is only available to the faction admin and optionally the faction moderators. If no player name is specified, it will either set ownership to the player running the command (if no owner is currently set) or completely clear ownership of the territory. New command /f ownerlist, to view a list of owners for the current area. Only works inside your own faction's territory. New conf.json options "ownedAreasEnabled", "ownedAreasModeratorsCanSet", "ownedAreaModeratorsBypass", "ownedAreaDenyBuild", "ownedAreaProtectMaterials", and "ownedAreaDenyUseage" (all defaulting to true) to determine whether faction moderators can set or bypass ownership (faction admin always can), and what sort of protection these owned areas have against normal members of the faction (members other than the owner(s), faction admin, and probably faction moderators). New conf.json option "ownedAreasLimitPerFaction" to limit how many owned areas can be set. New permission node "factions.ownershipBypass" which allows a player to bypass ownership protection, but only within the person's own faction.
various little tweaks and improvements to other code
moderate speed boost to FLocation code
made commandDisable permissions work for any command alias of a command, instead of just the first one
2011-07-30 20:17:00 -05:00

60 lines
1.4 KiB
Java

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.Factions;
public class FCommandOwnerList extends FBaseCommand {
public FCommandOwnerList() {
aliases.add("ownerlist");
helpDescription = "list owner(s) of this claimed land";
}
@Override
public void perform() {
boolean hasBypass = Factions.hasPermAdminBypass(player);
if ( ! hasBypass && ! assertHasFaction()) {
return;
}
if ( ! Conf.ownedAreasEnabled) {
me.sendMessage("Owned areas are disabled on this server.");
return;
}
Faction myFaction = me.getFaction();
FLocation flocation = new FLocation(me);
if (Board.getIdAt(flocation) != myFaction.getId()) {
if (!hasBypass) {
me.sendMessage("This land is not claimed by your faction.");
return;
}
myFaction = Board.getFactionAt(flocation);
if (!myFaction.isNormal()) {
me.sendMessage("This land is not claimed by any faction, thus no owners.");
return;
}
}
String owners = myFaction.getOwnerListString(flocation);
if (owners == null || owners.isEmpty()) {
me.sendMessage("No owners are set here; everyone in the faction has access.");
return;
}
me.sendMessage("Current owner(s) of this land: "+owners);
}
}