Search in sources :

Example 1 with BrushSettings

use of com.fastasyncworldedit.core.command.tool.brush.BrushSettings in project FastAsyncWorldEdit by IntellectualSites.

the class ToolUtilCommands method smask.

@Command(name = "smask", aliases = { "/smask", "/sourcemask", "sourcemask" }, desc = "Set the brush source mask", descFooter = "Set the brush source mask")
@CommandPermissions({ "worldedit.brush.options.mask", "worldedit.mask.brush" })
public void smask(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The destination mask", def = "") Mask maskArg, @Switch(name = 'h', desc = "Whether the offhand should be considered or not") boolean offHand, Arguments arguments) throws WorldEditException {
    BrushTool tool = session.getBrushTool(player, false);
    if (tool == null) {
        player.print(Caption.of("fawe.worldedit.brush.brush.none"));
        return;
    }
    if (maskArg == null) {
        player.print(Caption.of("fawe.worldedit.brush.brush.source.mask.disabled"));
        tool.setSourceMask(null);
        return;
    }
    BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
    String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
    settings.addSetting(BrushSettings.SettingType.SOURCE_MASK, lastArg);
    settings.setSourceMask(maskArg);
    tool.update();
    player.print(Caption.of("fawe.worldedit.brush.brush.source.mask"));
}
Also used : BrushTool(com.sk89q.worldedit.command.tool.BrushTool) BrushSettings(com.fastasyncworldedit.core.command.tool.brush.BrushSettings) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Example 2 with BrushSettings

use of com.fastasyncworldedit.core.command.tool.brush.BrushSettings in project FastAsyncWorldEdit by IntellectualSites.

the class ToolUtilCommands method scroll.

@Command(name = "scroll", desc = "Toggle between different target modes")
@CommandPermissions("worldedit.brush.scroll")
public void scroll(Player player, EditSession editSession, LocalSession session, @Switch(name = 'h', desc = "Whether the offhand should be considered or not") boolean offHand, @Arg(desc = "Target Modes", def = "none") Scroll.Action mode, @Arg(desc = "The scroll action", variable = true) List<String> commandStr) throws WorldEditException {
    BrushTool bt = session.getBrushTool(player, false);
    if (bt == null) {
        player.print(Caption.of("fawe.worldedit.brush.brush.none"));
        return;
    }
    BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
    Scroll action = Scroll.fromArguments(bt, player, session, mode, commandStr, true);
    settings.setScrollAction(action);
    if (mode == Scroll.Action.NONE) {
        player.print(Caption.of("fawe.worldedit.brush.brush.scroll.action.unset"));
    } else if (action != null) {
        String full = (mode.name().toLowerCase(Locale.ROOT) + " " + StringMan.join(commandStr, " ")).trim();
        settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
        player.print(Caption.of("fawe.worldedit.brush.brush.scroll.action.set", mode));
    }
    bt.update();
}
Also used : BrushTool(com.sk89q.worldedit.command.tool.BrushTool) Scroll(com.fastasyncworldedit.core.command.tool.scroll.Scroll) BrushSettings(com.fastasyncworldedit.core.command.tool.brush.BrushSettings) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Example 3 with BrushSettings

use of com.fastasyncworldedit.core.command.tool.brush.BrushSettings in project FastAsyncWorldEdit by IntellectualSites.

the class ToolUtilCommands method material.

// FAWE end
@Command(name = "material", aliases = { "mat", "/material", "pattern" }, desc = "Set the brush material")
@CommandPermissions("worldedit.brush.options.material")
public void material(Player player, LocalSession session, @Arg(desc = "The pattern of blocks to use") Pattern pattern, // FAWE start - add offhand
@Switch(name = 'h', desc = "Whether the offhand should be considered or not") boolean offHand, Arguments arguments) throws WorldEditException {
    BrushTool tool = session.getBrushTool(player, false);
    if (tool == null) {
        player.print(Caption.of("fawe.worldedit.brush.brush.none"));
        return;
    }
    if (pattern == null) {
        tool.setFill(null);
    } else {
        BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
        settings.setFill(pattern);
        String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
        settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
        tool.update();
    }
    // FAWE end
    player.print(Caption.of("worldedit.tool.material.set"));
}
Also used : BrushTool(com.sk89q.worldedit.command.tool.BrushTool) BrushSettings(com.fastasyncworldedit.core.command.tool.brush.BrushSettings) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Example 4 with BrushSettings

use of com.fastasyncworldedit.core.command.tool.brush.BrushSettings in project FastAsyncWorldEdit by IntellectualSites.

the class BrushTool method increment.

@Override
public boolean increment(Player player, int amount) {
    BrushSettings current = getContext();
    Scroll tmp = current.getScrollAction();
    if (tmp != null) {
        tmp.setTool(this);
        return tmp.increment(player, amount);
    }
    return false;
}
Also used : Scroll(com.fastasyncworldedit.core.command.tool.scroll.Scroll) BrushSettings(com.fastasyncworldedit.core.command.tool.brush.BrushSettings)

Example 5 with BrushSettings

use of com.fastasyncworldedit.core.command.tool.brush.BrushSettings in project FastAsyncWorldEdit by IntellectualSites.

the class BrushCommands method cylinderBrush.

@Command(name = "cylinder", aliases = { "cyl", "c" }, desc = "Choose the cylinder brush")
@CommandPermissions("worldedit.brush.cylinder")
public void cylinderBrush(InjectedValueAccess context, @Arg(desc = "The pattern of blocks to set") Pattern pattern, @Arg(desc = "The radius of the cylinder", def = "2") Expression radius, @Arg(desc = "The height of the cylinder", def = "1") int height, // FAWE start - hcyl thickness
@Arg(desc = "The thickness of the cylinder. Requires -h switch be given. 0 creates a standard hollow cylinder.", def = "0") double thickness, // FAWE end
@Switch(name = 'h', desc = "Create hollow cylinders instead") boolean hollow) throws WorldEditException {
    worldEdit.checkMaxBrushRadius(radius);
    worldEdit.checkMaxBrushRadius(height);
    BrushSettings settings;
    if (hollow) {
        // FAWE start - hcyl thickness
        settings = set(context, new HollowCylinderBrush(height, thickness), "worldedit.brush.cylinder");
    // FAWE end
    } else {
        settings = set(context, new CylinderBrush(height), "worldedit.brush.cylinder");
    }
    settings.setSize(radius).setFill(pattern);
}
Also used : CylinderBrush(com.sk89q.worldedit.command.tool.brush.CylinderBrush) HollowCylinderBrush(com.sk89q.worldedit.command.tool.brush.HollowCylinderBrush) BrushSettings(com.fastasyncworldedit.core.command.tool.brush.BrushSettings) HollowCylinderBrush(com.sk89q.worldedit.command.tool.brush.HollowCylinderBrush) ScatterCommand(com.fastasyncworldedit.core.command.tool.brush.ScatterCommand) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Aggregations

BrushSettings (com.fastasyncworldedit.core.command.tool.brush.BrushSettings)10 BrushTool (com.sk89q.worldedit.command.tool.BrushTool)6 CommandPermissions (com.sk89q.worldedit.command.util.CommandPermissions)6 Command (org.enginehub.piston.annotation.Command)6 Scroll (com.fastasyncworldedit.core.command.tool.scroll.Scroll)2 Brush (com.sk89q.worldedit.command.tool.brush.Brush)2 CylinderBrush (com.sk89q.worldedit.command.tool.brush.CylinderBrush)2 HollowCylinderBrush (com.sk89q.worldedit.command.tool.brush.HollowCylinderBrush)2 BlobBrush (com.fastasyncworldedit.core.command.tool.brush.BlobBrush)1 CatenaryBrush (com.fastasyncworldedit.core.command.tool.brush.CatenaryBrush)1 CircleBrush (com.fastasyncworldedit.core.command.tool.brush.CircleBrush)1 CommandBrush (com.fastasyncworldedit.core.command.tool.brush.CommandBrush)1 CopyPastaBrush (com.fastasyncworldedit.core.command.tool.brush.CopyPastaBrush)1 ErodeBrush (com.fastasyncworldedit.core.command.tool.brush.ErodeBrush)1 FlattenBrush (com.fastasyncworldedit.core.command.tool.brush.FlattenBrush)1 HeightBrush (com.fastasyncworldedit.core.command.tool.brush.HeightBrush)1 ImageBrush (com.fastasyncworldedit.core.command.tool.brush.ImageBrush)1 LayerBrush (com.fastasyncworldedit.core.command.tool.brush.LayerBrush)1 LineBrush (com.fastasyncworldedit.core.command.tool.brush.LineBrush)1 RaiseBrush (com.fastasyncworldedit.core.command.tool.brush.RaiseBrush)1