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-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;
|
|
|
|
import com.massivecraft.factions.Faction;
|
2011-10-08 22:03:44 +02:00
|
|
|
import com.massivecraft.factions.P;
|
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-31 03:17:00 +02:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.struct.Role;
|
|
|
|
|
|
|
|
|
|
|
|
public class FCommandOwner extends FBaseCommand {
|
|
|
|
|
|
|
|
public FCommandOwner() {
|
|
|
|
aliases.add("owner");
|
|
|
|
|
|
|
|
optionalParameters.add("player name");
|
|
|
|
|
|
|
|
helpDescription = "set ownership of claimed land";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
2011-10-08 22:03:44 +02:00
|
|
|
boolean hasBypass = P.hasPermAdminBypass(player);
|
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-31 03:17:00 +02:00
|
|
|
|
|
|
|
if ( ! hasBypass && ! assertHasFaction()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( isLocked() ) {
|
|
|
|
sendLockMessage();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! Conf.ownedAreasEnabled) {
|
|
|
|
me.sendMessage("Sorry, but owned areas are disabled on this server.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Faction myFaction = me.getFaction();
|
|
|
|
|
|
|
|
if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) {
|
|
|
|
me.sendMessage("Sorry, but you have reached the server's limit of "+Conf.ownedAreasLimitPerFaction+" owned areas per faction.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!hasBypass && !assertMinRole(Conf.ownedAreasModeratorsCanSet ? Role.MODERATOR : Role.ADMIN)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
FLocation flocation = new FLocation(me);
|
|
|
|
|
|
|
|
if (Board.getIdAt(flocation) != myFaction.getId()) {
|
|
|
|
if (!hasBypass) {
|
|
|
|
me.sendMessage("This land is not claimed by your faction, so you can't set ownership of it.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
myFaction = Board.getFactionAt(flocation);
|
|
|
|
if (!myFaction.isNormal()) {
|
|
|
|
me.sendMessage("This land is not claimed by a faction. Ownership is not possible.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FPlayer target;
|
|
|
|
|
|
|
|
if (parameters.size() > 0) {
|
|
|
|
target = findFPlayer(parameters.get(0), false);
|
|
|
|
} else {
|
|
|
|
target = me;
|
|
|
|
}
|
|
|
|
if (target == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
String playerName = target.getName();
|
|
|
|
|
|
|
|
if (target.getFaction().getId() != myFaction.getId()) {
|
|
|
|
me.sendMessage(playerName + " is not a member of this faction.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if no player name was passed, and this claim does already have owners set, clear them
|
|
|
|
if (parameters.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation)) {
|
|
|
|
myFaction.clearClaimOwnership(flocation);
|
|
|
|
me.sendMessage("You have cleared ownership for this claimed area.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (myFaction.isPlayerInOwnerList(playerName, flocation)) {
|
|
|
|
myFaction.removePlayerAsOwner(playerName, flocation);
|
|
|
|
me.sendMessage("You have removed ownership of this claimed land from "+playerName+".");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
|
|
|
if (!payForCommand(Conf.econCostOwner)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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-31 03:17:00 +02:00
|
|
|
myFaction.setPlayerAsOwner(playerName, flocation);
|
|
|
|
me.sendMessage("You have added "+playerName+" to the owner list for this claimed land.");
|
|
|
|
}
|
|
|
|
}
|