From 9151f8b6bfa657d5b5463a13d5937d43199f9a4f Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 12 Mar 2011 00:49:35 -0800 Subject: [PATCH] Added shortcut fire extinguisher brush. --- .../worldedit/commands/BrushCommands.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/com/sk89q/worldedit/commands/BrushCommands.java b/src/com/sk89q/worldedit/commands/BrushCommands.java index c4c05978b..981352ac7 100644 --- a/src/com/sk89q/worldedit/commands/BrushCommands.java +++ b/src/com/sk89q/worldedit/commands/BrushCommands.java @@ -30,7 +30,11 @@ import com.sk89q.worldedit.LocalSession; 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.blocks.BlockID; +import com.sk89q.worldedit.masks.BlockTypeMask; import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.patterns.SingleBlockPattern; import com.sk89q.worldedit.tools.BrushTool; import com.sk89q.worldedit.tools.brushes.ClipboardBrush; import com.sk89q.worldedit.tools.brushes.CylinderBrush; @@ -194,4 +198,36 @@ public class BrushCommands { player.print(String.format("Smooth brush equipped (%d x %dx).", radius, iterations)); } + + @Command( + aliases = {"ex", "extinguish"}, + usage = "[radius]", + desc = "Shortcut fire extinguisher brush", + min = 0, + max = 1 + ) + @CommandPermissions({"worldedit.brush.ex"}) + public static void extinguishBrush(CommandContext args, WorldEdit we, + LocalSession session, LocalPlayer player, EditSession editSession) + throws WorldEditException { + + LocalConfiguration config = we.getConfiguration(); + + int radius = args.argsLength() > 1 ? args.getInteger(1) : 5; + if (radius > config.maxBrushRadius) { + player.printError("Maximum allowed brush radius: " + + config.maxBrushRadius); + return; + } + + BrushTool tool = session.getBrushTool(player.getItemInHand()); + Pattern fill = new SingleBlockPattern(new BaseBlock(0)); + tool.setFill(fill); + tool.setSize(radius); + tool.setMask(new BlockTypeMask(BlockID.FIRE)); + tool.setBrush(new SphereBrush()); + + player.print(String.format("Extinguisher equipped (%d).", + radius)); + } }