Fixed an error that occured when clearing a non-existant region's parent.

This commit is contained in:
TomyLobo 2012-03-12 15:04:49 +01:00
parent 88d79a42e6
commit 2024a93126

View File

@ -835,7 +835,10 @@ public void setParent(CommandContext args, CommandSender sender) throws CommandE
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
ProtectedRegion region = mgr.getRegion(id);
if (region == null) {
throw new CommandException("Could not find a target region by that ID.");
}
if (args.argsLength() == 1) {
try {
region.setParent(null);
@ -848,10 +851,6 @@ public void setParent(CommandContext args, CommandSender sender) throws CommandE
String parentId = args.getString(1);
ProtectedRegion parent = mgr.getRegion(parentId);
if (region == null) {
throw new CommandException("Could not find a target region by that ID.");
}
if (parent == null) {
throw new CommandException("Could not find the parent region by that ID.");
}