Search in sources :

Example 1 with Scroll

use of com.fastasyncworldedit.core.command.tool.scroll.Scroll 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 2 with Scroll

use of com.fastasyncworldedit.core.command.tool.scroll.Scroll 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)

Aggregations

BrushSettings (com.fastasyncworldedit.core.command.tool.brush.BrushSettings)2 Scroll (com.fastasyncworldedit.core.command.tool.scroll.Scroll)2 BrushTool (com.sk89q.worldedit.command.tool.BrushTool)1 CommandPermissions (com.sk89q.worldedit.command.util.CommandPermissions)1 Command (org.enginehub.piston.annotation.Command)1