Saber-Factions/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java
2018-03-26 16:43:15 -05:00

62 lines
1.6 KiB
Java

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
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 {
public CmdSafeunclaimall() {
this.aliases.add("safeunclaimall");
this.aliases.add("safedeclaimall");
//this.requiredArgs.add("");
this.optionalArgs.put("world", "all");
this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
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) {
P.p.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName()));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SAFEUNCLAIMALL_DESCRIPTION;
}
}