Search in sources :

Example 81 with CommandPermissions

use of com.sk89q.worldedit.command.util.CommandPermissions in project FastAsyncWorldEdit by IntellectualSites.

the class SuperPickaxeCommands method single.

@Command(name = "single", desc = "Enable the single block super pickaxe mode")
@CommandPermissions("worldedit.superpickaxe")
public void single(Player player, LocalSession session) throws WorldEditException {
    session.setSuperPickaxe(new SinglePickaxe());
    session.enableSuperPickAxe();
    player.print(Caption.of("worldedit.tool.superpickaxe.mode.single"));
}
Also used : SinglePickaxe(com.sk89q.worldedit.command.tool.SinglePickaxe) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Example 82 with CommandPermissions

use of com.sk89q.worldedit.command.util.CommandPermissions in project FastAsyncWorldEdit by IntellectualSites.

the class SuperPickaxeCommands method recursive.

@Command(name = "recursive", aliases = { "recur" }, desc = "Enable the recursive super pickaxe pickaxe mode")
@CommandPermissions("worldedit.superpickaxe.recursive")
public void recursive(Player player, LocalSession session, @Arg(desc = "The range of the recursive pickaxe") double range) throws WorldEditException {
    LocalConfiguration config = we.getConfiguration();
    if (range > config.maxSuperPickaxeSize) {
        player.print(Caption.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
        return;
    }
    session.setSuperPickaxe(new RecursivePickaxe(range));
    session.enableSuperPickAxe();
    player.print(Caption.of("worldedit.tool.superpickaxe.mode.recursive"));
}
Also used : RecursivePickaxe(com.sk89q.worldedit.command.tool.RecursivePickaxe) LocalConfiguration(com.sk89q.worldedit.LocalConfiguration) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Example 83 with CommandPermissions

use of com.sk89q.worldedit.command.util.CommandPermissions in project FastAsyncWorldEdit by IntellectualSites.

the class ToolCommands method longrangebuildtool.

@Command(name = "lrbuild", aliases = { "/lrbuild" }, desc = "Long-range building tool")
@CommandPermissions("worldedit.tool.lrbuild")
public void longrangebuildtool(Player player, LocalSession session, @Arg(desc = "Pattern to set on left-click") Pattern primary, @Arg(desc = "Pattern to set on right-click") Pattern secondary) throws WorldEditException {
    setTool(player, session, new LongRangeBuildTool(primary, secondary), "worldedit.tool.lrbuild.equip");
    Component primaryName;
    Component secondaryName;
    if (primary instanceof BlockStateHolder) {
        primaryName = ((BlockStateHolder<?>) primary).getBlockType().getRichName();
    } else {
        primaryName = TextComponent.of("pattern");
    }
    if (secondary instanceof BlockStateHolder) {
        secondaryName = ((BlockStateHolder<?>) secondary).getBlockType().getRichName();
    } else {
        secondaryName = TextComponent.of("pattern");
    }
    player.print(Caption.of("worldedit.tool.lrbuild.set", primaryName, secondaryName));
}
Also used : BlockStateHolder(com.sk89q.worldedit.world.block.BlockStateHolder) LongRangeBuildTool(com.sk89q.worldedit.command.tool.LongRangeBuildTool) Component(com.sk89q.worldedit.util.formatting.text.Component) TextComponent(com.sk89q.worldedit.util.formatting.text.TextComponent) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Example 84 with CommandPermissions

use of com.sk89q.worldedit.command.util.CommandPermissions in project FastAsyncWorldEdit by IntellectualSites.

the class ToolUtilCommands method transform.

@Command(name = "transform", aliases = { "/transform" }, desc = "Set the brush transform")
@CommandPermissions({ "worldedit.brush.options.transform", "worldedit.transform.brush" })
public void transform(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The transform", def = "") ResettableExtent transform, @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 (transform == null) {
        player.print(Caption.of("fawe.worldedit.brush.brush.transform.disabled"));
        tool.setTransform(null);
        return;
    }
    BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
    String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
    settings.addSetting(BrushSettings.SettingType.TRANSFORM, lastArg);
    settings.setTransform(transform);
    tool.update();
    player.print(Caption.of("fawe.worldedit.brush.brush.transform"));
}
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 85 with CommandPermissions

use of com.sk89q.worldedit.command.util.CommandPermissions in project FastAsyncWorldEdit by IntellectualSites.

the class ToolUtilCommands method target.

@Command(name = "target", aliases = { "tar", "/target", "/tar" }, desc = "Toggle between different target modes")
@CommandPermissions("worldedit.brush.target")
public void target(Player player, LocalSession session, @Arg(name = "mode", desc = "int", def = "0") int mode) throws WorldEditException {
    BrushTool tool = session.getBrushTool(player, false);
    if (tool == null) {
        player.print(Caption.of("fawe.worldedit.brush.brush.none"));
        return;
    }
    TargetMode[] modes = TargetMode.values();
    TargetMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
    tool.setTargetMode(newMode);
    player.print(Caption.of("fawe.worldedit.brush.brush.target.mode.set", newMode));
}
Also used : BrushTool(com.sk89q.worldedit.command.tool.BrushTool) TargetMode(com.fastasyncworldedit.core.command.tool.TargetMode) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Aggregations

CommandPermissions (com.sk89q.worldedit.command.util.CommandPermissions)133 Command (org.enginehub.piston.annotation.Command)133 Logging (com.sk89q.worldedit.command.util.Logging)47 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)34 ScatterCommand (com.fastasyncworldedit.core.command.tool.brush.ScatterCommand)25 Confirm (com.sk89q.worldedit.command.util.annotation.Confirm)22 LocalConfiguration (com.sk89q.worldedit.LocalConfiguration)20 Region (com.sk89q.worldedit.regions.Region)19 Preload (com.sk89q.worldedit.command.util.annotation.Preload)17 File (java.io.File)17 ClipboardHolder (com.sk89q.worldedit.session.ClipboardHolder)16 URIClipboardHolder (com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder)15 MultiClipboardHolder (com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder)14 MaskTraverser (com.fastasyncworldedit.core.util.MaskTraverser)13 Mask (com.sk89q.worldedit.function.mask.Mask)11 IOException (java.io.IOException)11 BrushTool (com.sk89q.worldedit.command.tool.BrushTool)10 Player (com.sk89q.worldedit.entity.Player)10 Clipboard (com.sk89q.worldedit.extent.clipboard.Clipboard)10 Location (com.sk89q.worldedit.util.Location)10