Factions3/src/com/massivecraft/factions/commands/CmdWarclaim.java

54 lines
1.3 KiB
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions.commands;
2011-03-23 17:39:56 +01:00
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
2011-10-09 18:35:39 +02:00
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission;
2011-03-23 17:39:56 +01:00
2011-10-09 20:10:19 +02:00
public class CmdWarclaim extends FCommand
2011-10-09 18:35:39 +02:00
{
2011-03-23 17:39:56 +01:00
2011-10-09 20:10:19 +02:00
public CmdWarclaim()
2011-10-09 18:35:39 +02:00
{
2011-10-09 20:10:19 +02:00
this.aliases.add("warclaim");
this.aliases.add("war");
2011-03-23 17:39:56 +01:00
2011-10-09 18:35:39 +02:00
//this.requiredArgs.add("");
this.optionalArgs.put("radius", "0");
2011-04-08 21:01:46 +02:00
2011-10-09 20:10:19 +02:00
this.permission = Permission.MANAGE_WAR_ZONE.node;
2011-10-09 18:35:39 +02:00
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
2011-10-09 20:10:19 +02:00
this.setHelpShort("Claim land for the warzone");
2011-03-23 17:39:56 +01:00
}
2011-10-09 18:35:39 +02:00
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
2011-04-08 21:01:46 +02:00
// The current location of the player
FLocation playerFlocation = new FLocation(fme);
2011-04-08 21:01:46 +02:00
2011-10-09 18:35:39 +02:00
int radius = this.argAsInt(0, 0);
if (radius < 0) radius = 0;
FLocation from = playerFlocation.getRelative(radius, radius);
FLocation to = playerFlocation.getRelative(-radius, -radius);
for (FLocation locToClaim : FLocation.getArea(from, to))
{
2011-10-09 20:10:19 +02:00
Board.setFactionAt(Factions.i.getWarZone(), locToClaim);
2011-04-08 21:01:46 +02:00
}
2011-10-09 18:35:39 +02:00
2011-10-09 20:10:19 +02:00
sendMessageParsed("<i>You claimed <h>%d chunks<i> for the <a>war zone<i>.", (1+radius*2)*(1+radius*2));
2011-03-23 17:39:56 +01:00
}
}