Search in sources :

Example 1 with TargetMode

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

the class ScrollTarget method increment.

@Override
public boolean increment(Player player, int amount) {
    TargetMode mode = getTool().getTargetMode();
    int index = mode.ordinal() + amount;
    TargetMode[] modes = TargetMode.values();
    TargetMode newMode = modes[MathMan.wrap(index, 0, modes.length - 1)];
    getTool().setTargetMode(newMode);
    return true;
}
Also used : TargetMode(com.fastasyncworldedit.core.command.tool.TargetMode)

Example 2 with TargetMode

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

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