// Get the namespace
if (context.hasFlag('n')) {
if(!player.hasPermission("craftbook.mech.area.delete." + context.getFlag('n')))
throw new CommandException("You do not have permission to use this namespace.");
namespace = context.getFlag('n');
} else if (!player.hasPermission("craftbook.mech.area.delete.self")) throw new CommandPermissionsException();
if (Area.instance.shortenNames && namespace.length() > 15)
namespace = namespace.substring(0, 15);
boolean deleteAll = false;
if (context.argsLength() > 0 && !context.hasFlag('a')) {
areaId = context.getString(0);
} else if (context.hasFlag('a') && player.hasPermission("craftbook.mech.area.delete." + namespace + ".all")) {
deleteAll = true;
} else throw new CommandException("You need to define an area or -a to delete all areas.");
// add the area suffix
areaId = areaId + (Area.instance.useSchematics ? ".schematic" : ".cbcopy");
File areas = null;
try {
areas = new File(plugin.getDataFolder(), "areas/" + namespace);
} catch (Exception ignored) {
}
if (areas == null || !areas.exists())
throw new CommandException("The namespace " + namespace + " does not exist.");
if (deleteAll) {
if (deleteDir(areas)) {
player.print("All areas in the namespace " + namespace + " have been deleted.");
}