Allow unclaiming all safezones and warzones in a specific world

This commit is contained in:
Joel Puig Rubio
2017-09-04 22:57:51 +02:00
parent d7a366d764
commit 08c0995741
4 changed files with 47 additions and 5 deletions

View File

@@ -6,6 +6,8 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
import org.bukkit.World;
public class CmdSafeunclaimall extends FCommand {
@@ -14,7 +16,7 @@ public class CmdSafeunclaimall extends FCommand {
this.aliases.add("safedeclaimall");
//this.requiredArgs.add("");
//this.optionalArgs.put("radius", "0");
this.optionalArgs.put("world", "all");
this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
@@ -28,7 +30,21 @@ public class CmdSafeunclaimall extends FCommand {
@Override
public void perform() {
Board.getInstance().unclaimAll(Factions.getInstance().getSafeZone().getId());
String worldName = argAsString(0);
World world = null;
if (worldName != null) {
world = Bukkit.getWorld(worldName);
}
String id = Factions.getInstance().getSafeZone().getId();
if (world == null) {
Board.getInstance().unclaimAll(id);
} else {
Board.getInstance().unclaimAllInWorld(id, world);
}
msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED);
if (Conf.logLandUnclaims) {

View File

@@ -6,6 +6,8 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
import org.bukkit.World;
public class CmdWarunclaimall extends FCommand {
@@ -14,7 +16,7 @@ public class CmdWarunclaimall extends FCommand {
this.aliases.add("wardeclaimall");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.optionalArgs.put("world", "all");
this.permission = Permission.MANAGE_WAR_ZONE.node;
this.disableOnLock = true;
@@ -27,8 +29,20 @@ public class CmdWarunclaimall extends FCommand {
@Override
public void perform() {
Board.getInstance().unclaimAll(Factions.getInstance().getWarZone().getId());
msg(TL.COMMAND_WARUNCLAIMALL_SUCCESS);
String worldName = argAsString(0);
World world = null;
if (worldName != null) {
world = Bukkit.getWorld(worldName);
}
String id = Factions.getInstance().getWarZone().getId();
if (world == null) {
Board.getInstance().unclaimAll(id);
} else {
Board.getInstance().unclaimAllInWorld(id, world);
}
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName()));