use of com.sk89q.worldedit.command.tool.BrushTool in project FastAsyncWorldEdit by IntellectualSites.
the class ToolUtilCommands method targetOffset.
@Command(name = "targetoffset", aliases = { "to" }, desc = "Set the targeting mask")
@CommandPermissions("worldedit.brush.targetoffset")
public void targetOffset(Player player, EditSession editSession, LocalSession session, @Arg(name = "offset", desc = "offset", def = "0") int offset) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
return;
}
tool.setTargetOffset(offset);
player.print(Caption.of("fawe.worldedit.brush.brush.target.offset.set", offset));
}
use of com.sk89q.worldedit.command.tool.BrushTool in project FastAsyncWorldEdit by IntellectualSites.
the class ToolUtilCommands method secondary.
@Command(name = "secondary", aliases = { "/secondary" }, desc = "Set the left click brush", descFooter = "Set the left click brush")
@CommandPermissions("worldedit.brush.secondary")
public void secondary(Player player, LocalSession session, @Arg(desc = "The brush command", variable = true) List<String> commandStr) throws WorldEditException {
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
BrushTool tool = session.getBrushTool(player, false);
session.setTool(item, null, player);
String cmd = "brush " + StringMan.join(commandStr, " ");
CommandEvent event = new CommandEvent(player, cmd);
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
BrushTool newTool = session.getBrushTool(item, player, false);
if (newTool != null && tool != null) {
newTool.setPrimary(tool.getPrimary());
}
}
use of com.sk89q.worldedit.command.tool.BrushTool 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"));
}
use of com.sk89q.worldedit.command.tool.BrushTool 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();
}
use of com.sk89q.worldedit.command.tool.BrushTool 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"));
}
Aggregations