Factions3/src/org/mcteam/factions/commands/FCommandUnclaim.java
Brettflan b490c5f196 Laundry list of changes for 1.2.0 release:
/f map now has a nifty faction name key  (LexManos)
There are now War Zones; these work similar to Safe Zones, except PvP is enabled and monsters are not blocked  (Brettflan)
Players now only regenerate power while actually online  (Brettflan)
New command available to prevent power loss in specific worlds  (Brettflan)
New command available to prevent faction land claims in specific worlds (doesn't affect safezone and warzone claims)  (Brettflan)
New command to unclaim all safezone areas  (Brettflan)
Players are now prevented from using /f home if an enemy is nearby, and the players isn't in a safezone or their own faction territory  (Brettflan)
New option to make membership default to closed for newly created factions  (Brettflan)
When an admin has bypass mode enabled (/f bypass), they can now unclaim any faction land they're standing on  (Brettflan)
2011-05-29 16:28:29 -05:00

78 lines
1.8 KiB
Java

package org.mcteam.factions.commands;
import org.mcteam.factions.Board;
import org.mcteam.factions.Conf;
import org.mcteam.factions.FLocation;
import org.mcteam.factions.Faction;
import org.mcteam.factions.Factions;
import org.mcteam.factions.struct.Role;
public class FCommandUnclaim extends FBaseCommand {
public FCommandUnclaim() {
aliases.add("unclaim");
aliases.add("declaim");
helpDescription = "Unclaim the land where you are standing";
}
public void perform() {
if( isLocked() ) {
sendLockMessage();
return;
}
FLocation flocation = new FLocation(me);
Faction otherFaction = Board.getFactionAt(flocation);
if (otherFaction.isSafeZone()) {
if (Factions.hasPermManageSafeZone(sender)) {
Board.removeAt(flocation);
sendMessage("Safe zone was unclaimed.");
} else {
sendMessage("This is a safe zone. You lack permissions to unclaim.");
}
return;
}
else if (otherFaction.isWarZone()) {
if (Factions.hasPermManageWarZone(sender)) {
Board.removeAt(flocation);
sendMessage("War zone was unclaimed.");
} else {
sendMessage("This is a war zone. You lack permissions to unclaim.");
}
return;
}
if (Conf.adminBypassPlayers.contains(player.getName())) {
Board.removeAt(flocation);
otherFaction.sendMessage(me.getNameAndRelevant(otherFaction)+Conf.colorSystem+" unclaimed some of your land.");
sendMessage("You unclaimed this land.");
return;
}
if ( ! assertHasFaction()) {
return;
}
if ( ! assertMinRole(Role.MODERATOR)) {
return;
}
Faction myFaction = me.getFaction();
if ( myFaction != otherFaction) {
sendMessage("You don't own this land.");
return;
}
Board.removeAt(flocation);
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed some land.");
}
}