Class BrushTool

java.lang.Object
com.sk89q.worldedit.command.tool.BrushTool
All Implemented Interfaces:
MovableTool, ResettableTool, ScrollTool, DoubleActionTraceTool, Tool, TraceTool, Serializable
Direct Known Subclasses:
DistanceWand, InspectBrush, LongRangeBuildTool

Builds a shape at the place being looked at.
See Also:
  • Field Details

    • MAX_RANGE

      protected static int MAX_RANGE
    • range

      protected int range
    • DEFAULT_RANGE

      protected static int DEFAULT_RANGE
  • Constructor Details

    • BrushTool

      public BrushTool(String permission)
      Construct the tool.
      Parameters:
      permission - the permission to check before use is allowed
    • BrushTool

      public BrushTool()
  • Method Details

    • setHolder

      public void setHolder(BaseItem holder)
    • isSet

      public boolean isSet()
    • update

      public void update()
    • getContext

      public BrushSettings getContext()
    • setContext

      public void setContext(BrushSettings context)
    • canUse

      public boolean canUse(Actor player)
      Description copied from interface: Tool
      Checks to see if the player can still be using this tool (considering permissions and such).
      Specified by:
      canUse in interface Tool
      Parameters:
      player - the actor
      Returns:
      true if use is permitted
    • getTransform

      public ResettableExtent getTransform()
    • getPrimary

      public BrushSettings getPrimary()
    • getSecondary

      public BrushSettings getSecondary()
    • getOffHand

      public BrushSettings getOffHand()
    • setPrimary

      public void setPrimary(BrushSettings primary)
    • setSecondary

      public void setSecondary(BrushSettings secondary)
    • setTransform

      public void setTransform(ResettableExtent transform)
    • getSourceMask

      public Mask getSourceMask()
      Get the filter.
      Returns:
      the filter
    • reset

      public boolean reset()
      Specified by:
      reset in interface ResettableTool
    • setMask

      public void setMask(Mask filter)
      Set the block filter used for identifying blocks to replace.
      Parameters:
      filter - the filter to set
    • getMask

      public Mask getMask()
      Get the filter.
      Returns:
      the filter
    • getTraceMask

      @Nullable public Mask getTraceMask()
      Get the mask used for identifying where to stop traces.
      Returns:
      the mask used to stop block traces
    • setTraceMask

      public void setTraceMask(@Nullable Mask traceMask)
      Set the block mask used for identifying where to stop traces.
      Parameters:
      traceMask - the mask used to stop block traces
    • setSourceMask

      public void setSourceMask(Mask filter)
      Set the block filter used for identifying blocks to replace.
      Parameters:
      filter - the filter to set
    • setBrush

      public void setBrush(Brush brush, String permission)
      Set the brush.
      Parameters:
      brush - the brush
      permission - the permission
    • getBrush

      public Brush getBrush()
      Get the current brush.
      Returns:
      the current brush
    • setFill

      public void setFill(@Nullable Pattern material)
      Set the material.
      Parameters:
      material - the material
    • getMaterial

      @Nullable public Pattern getMaterial()
      Get the material.
      Returns:
      the material
    • getSize

      public double getSize()
      Get the set brush size.
      Returns:
      a radius
    • setSize

      public void setSize(double radius)
      Set the set brush size.
      Parameters:
      radius - a radius
    • setSize

      public void setSize(Expression radius)
      Set the set brush size.
      Parameters:
      radius - a radius
    • getRange

      public int getRange()
      Get the set brush range.
      Returns:
      the range of the brush in blocks
    • setRange

      public void setRange(int range)
      Set the set brush range.
      Parameters:
      range - the range of the brush in blocks
    • actPrimary

      public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session)
      Description copied from interface: TraceTool
      Perform the primary action of this trace tool.
      Specified by:
      actPrimary in interface TraceTool
      Parameters:
      server - The platform
      config - The config instance
      player - The player
      session - The local session
      Returns:
      true to cancel the original event which triggered this action (if possible)
    • getPosition

      public BlockVector3 getPosition(EditSession editSession, Player player)
    • act

      public boolean act(com.sk89q.worldedit.command.tool.BrushTool.BrushAction action, Player player, LocalSession session)
    • actSecondary

      public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session)
      Description copied from interface: DoubleActionTraceTool
      Perform the secondary function of this tool.
      Specified by:
      actSecondary in interface DoubleActionTraceTool
      Parameters:
      server - The platform
      config - The config instance
      player - The player
      session - The local session
      Returns:
      true to cancel the original event which triggered this action (if possible)
    • setScrollAction

      public void setScrollAction(Scroll scrollAction)
    • setTargetOffset

      public void setTargetOffset(int targetOffset)
    • setTargetMode

      public void setTargetMode(TargetMode targetMode)
    • getTargetMode

      public TargetMode getTargetMode()
    • getTargetOffset

      public int getTargetOffset()
    • increment

      public boolean increment(Player player, int amount)
      Specified by:
      increment in interface ScrollTool
    • move

      public boolean move(Player player)
      Specified by:
      move in interface MovableTool