Fix issues with 94619e3f. Closes WORLDEDIT-2221.

This commit is contained in:
Wizjany 2012-11-22 13:28:36 -05:00
parent b2ff0fb2a2
commit aadfc30fbb
2 changed files with 21 additions and 13 deletions

View File

@ -19,6 +19,8 @@
package com.sk89q.worldedit.commands;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
import java.util.Comparator;
import java.util.Set;
import java.util.SortedSet;
@ -30,11 +32,19 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.CommandsManager;
import com.sk89q.minecraft.util.commands.Console;
import com.sk89q.minecraft.util.commands.Logging;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EntityType;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.LocalWorld.KillFlags;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.patterns.*;
import com.sk89q.worldedit.patterns.Pattern;
import com.sk89q.worldedit.patterns.SingleBlockPattern;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
@ -368,19 +378,15 @@ public class UtilityCommands {
LocalConfiguration config = we.getConfiguration();
final int radius;
int radius = config.butcherDefaultRadius;
if (args.argsLength() > 0) {
if (args.getString(0).equals("all")) {
radius = -1;
}
else {
} else {
radius = Math.max(1, args.getInteger(0));
}
}
else{
radius = config.butcherDefaultRadius;
}
FlagContainer flags = new FlagContainer(player);
flags.or(KillFlags.FRIENDLY , args.hasFlag('f'));
@ -400,10 +406,11 @@ public class UtilityCommands {
}
}
if (radius < 0)
if (radius < 0) {
player.print("Killed " + killed + " mobs.");
else
player.print("Killed " + killed + " mobs in a radius of "+radius+".");
} else {
player.print("Killed " + killed + " mobs in a radius of " + radius + ".");
}
}
public class FlagContainer {
@ -496,6 +503,7 @@ public class UtilityCommands {
if (args.argsLength() == 0) {
SortedSet<String> commands = new TreeSet<String>(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
final int ret = o1.replaceAll("/", "").compareToIgnoreCase(o2.replaceAll("/", ""));
if (ret == 0) {

View File

@ -58,7 +58,7 @@ history:
expiration: 10
butcher:
butcher-default-radius: -1
butcher-default-radius: -1
wand-item: 271
shell-save-type: