2017-11-16 22:32:09 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
|
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.World;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2019-01-28 01:49:07 +00:00
|
|
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
|
2018-07-28 07:11:48 +00:00
|
|
|
@CommandParameters(description = "Wipe all WorldGuard regions for a specified world.", usage = "/<command> <world>")
|
|
|
|
public class Command_wiperegions extends FreedomCommand
|
|
|
|
{
|
2017-11-16 22:32:09 +00:00
|
|
|
@Override
|
2018-07-28 07:11:48 +00:00
|
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
2018-07-30 07:23:01 +00:00
|
|
|
if (!plugin.wgb.isEnabled())
|
2017-11-16 22:32:09 +00:00
|
|
|
{
|
2018-07-28 07:11:48 +00:00
|
|
|
msg("WorldGuard is not enabled.");
|
2017-11-16 22:32:09 +00:00
|
|
|
return true;
|
|
|
|
}
|
2018-07-28 07:11:48 +00:00
|
|
|
|
|
|
|
if (args.length != 1)
|
|
|
|
{
|
2017-11-16 22:32:09 +00:00
|
|
|
return false;
|
|
|
|
}
|
2018-07-28 07:11:48 +00:00
|
|
|
|
2017-11-16 22:32:09 +00:00
|
|
|
World world = server.getWorld(args[0]);
|
|
|
|
if (world == null)
|
|
|
|
{
|
2019-01-28 01:49:07 +00:00
|
|
|
msg("There is no world named \"" + args[0] + "\"", ChatColor.RED);
|
2017-11-16 22:32:09 +00:00
|
|
|
return true;
|
|
|
|
}
|
2018-02-09 08:21:44 +00:00
|
|
|
if (world.equals(plugin.wm.adminworld.getWorld()))
|
2017-11-16 22:32:09 +00:00
|
|
|
{
|
2018-02-09 08:21:44 +00:00
|
|
|
checkRank(Rank.SENIOR_ADMIN);
|
2017-11-16 22:32:09 +00:00
|
|
|
}
|
2019-01-28 01:49:07 +00:00
|
|
|
|
|
|
|
int regionsWiped = plugin.wgb.wipeRegions(world);
|
|
|
|
|
|
|
|
if (regionsWiped != 0)
|
2017-11-16 22:32:09 +00:00
|
|
|
{
|
2019-01-28 01:49:07 +00:00
|
|
|
FUtil.adminAction(sender.getName(), "Wiped all regions in " + world.getName(), true);
|
|
|
|
msg("Wiped " + regionsWiped + " regions in " + world.getName());
|
2017-11-16 22:32:09 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-01-28 01:49:07 +00:00
|
|
|
msg(ChatColor.RED + "No regions were found in \"" + world.getName() + "\"");
|
2017-11-16 22:32:09 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|