This commit is contained in:
drtshock
2014-07-01 15:10:18 -05:00
parent 5066934a95
commit 8a6a97cc90
110 changed files with 3131 additions and 1228 deletions

View File

@@ -10,23 +10,31 @@ import com.massivecraft.factions.util.SpiralTask;
public class CmdClaim extends FCommand {
public CmdClaim() {
super(); this.aliases.add("claim");
super();
this.aliases.add("claim");
//this.requiredArgs.add("");
this.optionalArgs.put("faction", "your"); this.optionalArgs.put("radius", "1");
this.optionalArgs.put("faction", "your");
this.optionalArgs.put("radius", "1");
this.permission = Permission.CLAIM.node; this.disableOnLock = true;
this.permission = Permission.CLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// Read and validate input
final Faction forFaction = this.argAsFaction(0, myFaction); int radius = this.argAsInt(1, 1);
final Faction forFaction = this.argAsFaction(0, myFaction);
int radius = this.argAsInt(1, 1);
if (radius < 1) {
msg("<b>If you specify a radius, it must be at least 1."); return;
msg("<b>If you specify a radius, it must be at least 1.");
return;
}
if (radius < 2) {
@@ -35,7 +43,8 @@ public class CmdClaim extends FCommand {
} else {
// radius claim
if (!Permission.CLAIM_RADIUS.has(sender, false)) {
msg("<b>You do not have permission to claim in a radius."); return;
msg("<b>You do not have permission to claim in a radius.");
return;
}
new SpiralTask(new FLocation(me), radius) {
@@ -45,8 +54,11 @@ public class CmdClaim extends FCommand {
@Override
public boolean work() {
boolean success = fme.attemptClaim(forFaction, this.currentLocation(), true);
if (success) { failCount = 0; } else if (!success && failCount++ >= limit) {
this.stop(); return false;
if (success) {
failCount = 0;
} else if (!success && failCount++ >= limit) {
this.stop();
return false;
}
return true;