2011-07-18 22:06:02 +02:00
|
|
|
package com.massivecraft.factions.commands;
|
2011-06-10 21:26:12 +02:00
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
2011-07-18 22:06:02 +02:00
|
|
|
|
|
|
|
import com.massivecraft.factions.Board;
|
|
|
|
import com.massivecraft.factions.FLocation;
|
|
|
|
import com.massivecraft.factions.Faction;
|
2011-10-08 22:03:44 +02:00
|
|
|
import com.massivecraft.factions.P;
|
2011-06-10 21:26:12 +02:00
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public class FCommandAutoSafeclaim extends FCommand {
|
2011-06-10 21:26:12 +02:00
|
|
|
|
|
|
|
public FCommandAutoSafeclaim() {
|
|
|
|
aliases.add("autosafe");
|
|
|
|
|
|
|
|
optionalParameters.add("on|off");
|
|
|
|
|
|
|
|
helpDescription = "Auto-claim land for the safezone";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasPermission(CommandSender sender) {
|
2011-10-08 22:03:44 +02:00
|
|
|
return P.hasPermManageSafeZone(sender);
|
2011-06-10 21:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
|
|
|
|
if( isLocked() ) {
|
|
|
|
sendLockMessage();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean enable = !me.autoSafeZoneEnabled();
|
|
|
|
|
|
|
|
if (parameters.size() > 0)
|
|
|
|
enable = parseBool(parameters.get(0));
|
|
|
|
|
|
|
|
me.enableAutoSafeZone(enable);
|
|
|
|
|
|
|
|
if (!enable) {
|
|
|
|
sendMessage("Auto-claiming of safe zone disabled.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sendMessage("Auto-claiming of safe zone enabled.");
|
|
|
|
|
|
|
|
FLocation playerFlocation = new FLocation(me);
|
|
|
|
|
|
|
|
if (!Board.getFactionAt(playerFlocation).isSafeZone()) {
|
|
|
|
Board.setFactionAt(Faction.getSafeZone(), playerFlocation);
|
|
|
|
sendMessage("This land is now a safe zone.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|