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;
|
|
|
|
|
|
|
|
@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH)
|
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-02-09 08:21:44 +00:00
|
|
|
if (!plugin.wgb.isPluginEnabled())
|
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)
|
|
|
|
{
|
2018-07-28 07:11:48 +00:00
|
|
|
msg("World : \"" + args[0] + "\" not found.");
|
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
|
|
|
}
|
2018-02-09 08:21:44 +00:00
|
|
|
if (plugin.wgb.wipeRegions(world))
|
2017-11-16 22:32:09 +00:00
|
|
|
{
|
|
|
|
FUtil.adminAction(sender.getName(), "Wiping regions for world: " + world.getName(), true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-07-28 07:11:48 +00:00
|
|
|
msg(ChatColor.RED + "No regions were found in: \"" + world.getName() + "\".");
|
2017-11-16 22:32:09 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|