Added flood fill tool, fixed data values not being set properly.

This commit is contained in:
sk89q
2011-06-04 19:41:12 -07:00
parent 730244056c
commit 0f040429c5
4 changed files with 151 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import com.sk89q.minecraft.util.commands.NestedCommand;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.patterns.Pattern;
import com.sk89q.worldedit.tools.*;
import com.sk89q.worldedit.util.TreeGenerator;
@ -123,6 +124,32 @@ public class ToolCommands {
+ ItemType.toHeldName(player.getItemInHand()) + ".");
}
@Command(
aliases = {"floodfill", "flood"},
usage = "",
desc = "Flood fill tool",
min = 2,
max = 2
)
@CommandPermissions({"worldedit.tool.flood-fill"})
public static void floodFill(CommandContext args, WorldEdit we,
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
LocalConfiguration config = we.getConfiguration();
int range = args.getInteger(1);
if (range > config.maxSuperPickaxeSize) {
player.printError("Maximum range: " + config.maxSuperPickaxeSize);
return;
}
Pattern pattern = we.getBlockPattern(player, args.getString(0));
session.setTool(player.getItemInHand(), new FloodFillTool(range, pattern));
player.print("Block flood fill tool bound to "
+ ItemType.toHeldName(player.getItemInHand()) + ".");
}
@Command(
aliases = {"brush", "br"},
desc = "Brush tool"