2014-04-03 02:08:50 +00:00
|
|
|
/*
|
2014-04-04 22:03:18 +00:00
|
|
|
* WorldEdit, a Minecraft world manipulation toolkit
|
|
|
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
|
|
* Copyright (C) WorldEdit team and contributors
|
2014-04-03 02:08:50 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or
|
2014-04-03 02:08:50 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
|
|
* for more details.
|
2014-04-03 02:08:50 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2014-04-03 02:08:50 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-04-04 22:03:18 +00:00
|
|
|
*/
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
package com.sk89q.worldedit.command;
|
|
|
|
|
2019-12-16 09:01:41 +00:00
|
|
|
import com.boydti.fawe.config.Caption;
|
2019-11-21 19:56:10 +00:00
|
|
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
2019-08-29 12:57:03 +00:00
|
|
|
import com.boydti.fawe.object.brush.BrushSettings;
|
|
|
|
import com.boydti.fawe.object.brush.TargetMode;
|
2019-10-23 14:44:13 +00:00
|
|
|
import com.boydti.fawe.object.brush.scroll.Scroll;
|
2019-08-29 12:57:03 +00:00
|
|
|
import com.boydti.fawe.object.brush.visualization.VisualMode;
|
|
|
|
import com.boydti.fawe.object.extent.ResettableExtent;
|
|
|
|
import com.boydti.fawe.util.MathMan;
|
|
|
|
import com.boydti.fawe.util.StringMan;
|
|
|
|
import com.google.common.collect.Iterables;
|
|
|
|
import com.sk89q.worldedit.EditSession;
|
2018-07-30 13:26:06 +00:00
|
|
|
import com.sk89q.worldedit.LocalSession;
|
|
|
|
import com.sk89q.worldedit.WorldEdit;
|
|
|
|
import com.sk89q.worldedit.WorldEditException;
|
2019-08-29 12:57:03 +00:00
|
|
|
import com.sk89q.worldedit.blocks.BaseItem;
|
|
|
|
import com.sk89q.worldedit.command.argument.Arguments;
|
|
|
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
2019-07-06 00:46:48 +00:00
|
|
|
import com.sk89q.worldedit.command.util.CommandPermissions;
|
|
|
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
2014-06-28 02:55:38 +00:00
|
|
|
import com.sk89q.worldedit.entity.Player;
|
2019-08-29 12:57:03 +00:00
|
|
|
import com.sk89q.worldedit.event.platform.CommandEvent;
|
|
|
|
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
2014-06-28 02:55:38 +00:00
|
|
|
import com.sk89q.worldedit.function.mask.Mask;
|
|
|
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
2019-08-29 12:57:03 +00:00
|
|
|
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
2018-06-17 07:50:04 +00:00
|
|
|
import com.sk89q.worldedit.util.HandSide;
|
2019-07-06 00:46:48 +00:00
|
|
|
import org.enginehub.piston.annotation.Command;
|
|
|
|
import org.enginehub.piston.annotation.CommandContainer;
|
|
|
|
import org.enginehub.piston.annotation.param.Arg;
|
2019-08-29 12:57:03 +00:00
|
|
|
import org.enginehub.piston.annotation.param.Switch;
|
2019-11-20 00:11:54 +00:00
|
|
|
import org.jetbrains.annotations.Range;
|
2019-08-29 12:57:03 +00:00
|
|
|
|
|
|
|
import java.util.List;
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tool commands.
|
|
|
|
*/
|
2019-07-06 00:46:48 +00:00
|
|
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
2014-04-03 02:08:50 +00:00
|
|
|
public class ToolUtilCommands {
|
|
|
|
private final WorldEdit we;
|
|
|
|
|
|
|
|
public ToolUtilCommands(WorldEdit we) {
|
|
|
|
this.we = we;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
2019-08-29 12:57:03 +00:00
|
|
|
name = "mask",
|
|
|
|
desc = "Set the brush destination mask"
|
2014-04-03 02:08:50 +00:00
|
|
|
)
|
2019-08-29 12:57:03 +00:00
|
|
|
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
|
|
|
public void mask(Player player, LocalSession session,
|
|
|
|
@Switch(name = 'h', desc = "TODO")
|
|
|
|
boolean offHand,
|
|
|
|
@Arg(desc = "The destination mask", def = "")
|
|
|
|
Mask maskOpt,
|
|
|
|
Arguments arguments)
|
|
|
|
throws WorldEditException {
|
|
|
|
BrushTool tool = session.getBrushTool(player, false);
|
|
|
|
if (tool == null) {
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
2019-07-06 00:46:48 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-06 20:18:44 +00:00
|
|
|
if (maskOpt == null) {
|
2020-01-26 18:01:16 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.mask.disabled"));
|
2019-08-29 12:57:03 +00:00
|
|
|
tool.setMask(null);
|
2020-01-26 18:01:16 +00:00
|
|
|
} else {
|
|
|
|
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
|
|
|
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get()))
|
|
|
|
.getSubstring();
|
|
|
|
settings.addSetting(BrushSettings.SettingType.MASK, lastArg);
|
|
|
|
settings.setMask(maskOpt);
|
|
|
|
tool.update();
|
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.mask.set"));
|
|
|
|
}
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
2019-08-29 12:57:03 +00:00
|
|
|
name = "material",
|
|
|
|
aliases = {"mat", "/material", "pattern"},
|
|
|
|
desc = "Set the brush material"
|
2014-04-03 02:08:50 +00:00
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.brush.options.material")
|
2019-07-06 00:46:48 +00:00
|
|
|
public void material(Player player, LocalSession session,
|
2019-10-23 16:58:36 +00:00
|
|
|
@Arg(desc = "The pattern of blocks to use")
|
|
|
|
Pattern pattern,
|
2019-08-29 12:57:03 +00:00
|
|
|
@Switch(name = 'h', desc = "TODO")
|
|
|
|
boolean offHand,
|
|
|
|
Arguments arguments) throws WorldEditException {
|
|
|
|
BrushTool tool = session.getBrushTool(player, false);
|
|
|
|
if (tool == null) {
|
2020-01-26 18:01:16 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
2019-08-29 12:57:03 +00:00
|
|
|
return;
|
2019-11-19 21:23:47 +00:00
|
|
|
}
|
2019-10-23 16:58:36 +00:00
|
|
|
if (pattern == null) {
|
2019-08-29 12:57:03 +00:00
|
|
|
tool.setFill(null);
|
2019-11-21 13:50:05 +00:00
|
|
|
} 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();
|
|
|
|
}
|
2020-01-26 18:01:16 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.material.set"));
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
2019-04-25 19:49:03 +00:00
|
|
|
name = "range",
|
|
|
|
desc = "Set the brush range"
|
2019-11-19 21:23:47 +00:00
|
|
|
)
|
2014-04-03 02:08:50 +00:00
|
|
|
@CommandPermissions("worldedit.brush.options.range")
|
2019-07-06 00:46:48 +00:00
|
|
|
public void range(Player player, LocalSession session,
|
2019-10-23 16:58:36 +00:00
|
|
|
@Arg(desc = "The range of the brush")
|
2019-04-25 19:49:03 +00:00
|
|
|
int range) throws WorldEditException {
|
2019-11-19 21:23:47 +00:00
|
|
|
session.getBrushTool(player, false).setRange(range);
|
2019-10-27 07:19:30 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.range.set"));
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
2019-04-25 19:49:03 +00:00
|
|
|
name = "size",
|
|
|
|
desc = "Set the brush size"
|
2014-04-03 02:08:50 +00:00
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.brush.options.size")
|
2019-07-06 00:46:48 +00:00
|
|
|
public void size(Player player, LocalSession session,
|
2019-04-25 19:49:03 +00:00
|
|
|
@Arg(desc = "The size of the brush")
|
|
|
|
int size) throws WorldEditException {
|
2019-10-23 16:58:36 +00:00
|
|
|
we.checkMaxBrushRadius(size);
|
2019-07-06 00:46:48 +00:00
|
|
|
|
2019-11-19 21:23:47 +00:00
|
|
|
session.getBrushTool(player, false).setSize(size);
|
2019-10-27 07:19:30 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.size.set"));
|
2019-08-29 12:57:03 +00:00
|
|
|
}
|
2020-02-05 05:37:42 +00:00
|
|
|
|
2019-08-29 12:57:03 +00:00
|
|
|
@Command(
|
2019-05-24 01:12:31 +00:00
|
|
|
name = "tracemask",
|
2019-11-19 21:23:47 +00:00
|
|
|
aliases = {"tarmask", "tm", "targetmask"},
|
2019-05-24 01:12:31 +00:00
|
|
|
desc = "Set the mask used to stop tool traces"
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.brush.options.tracemask")
|
|
|
|
public void traceMask(Player player, LocalSession session,
|
|
|
|
@Arg(desc = "The trace mask to set", def = "")
|
2019-11-19 21:23:47 +00:00
|
|
|
Mask maskOpt) throws WorldEditException {
|
|
|
|
session.getBrushTool(player, false).setTraceMask(maskOpt);
|
|
|
|
if (maskOpt == null) {
|
2019-10-27 07:19:30 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.disabled"));
|
2019-05-24 01:12:31 +00:00
|
|
|
} else {
|
2019-10-27 07:19:30 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.set"));
|
2019-05-24 01:12:31 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-19 21:23:47 +00:00
|
|
|
|
|
|
|
@Command(
|
2019-11-20 03:40:52 +00:00
|
|
|
name = "/superpickaxe",
|
|
|
|
aliases = {",", "/sp", "/pickaxe"},
|
|
|
|
desc = "Toggle the super pickaxe function"
|
2019-08-29 12:57:03 +00:00
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.superpickaxe")
|
|
|
|
public void togglePickaxe(Player player, LocalSession session,
|
2019-11-19 21:23:47 +00:00
|
|
|
@Arg(desc = "The new super pickaxe state", def = "")
|
|
|
|
Boolean superPickaxe) {
|
|
|
|
boolean hasSuperPickAxe = session.hasSuperPickAxe();
|
|
|
|
if (superPickaxe != null && superPickaxe == hasSuperPickAxe) {
|
2019-11-21 13:50:05 +00:00
|
|
|
player.printError(TranslatableComponent.of(superPickaxe ? "worldedit.tool.superpickaxe.enabled.already" : "worldedit.tool.superpickaxe.disabled.already"));
|
2019-08-29 12:57:03 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-11-19 21:23:47 +00:00
|
|
|
if (hasSuperPickAxe) {
|
2019-08-29 12:57:03 +00:00
|
|
|
session.disableSuperPickAxe();
|
2019-11-21 13:50:05 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.disabled"));
|
2019-07-06 00:46:48 +00:00
|
|
|
} else {
|
2019-08-29 12:57:03 +00:00
|
|
|
session.enableSuperPickAxe();
|
2019-11-21 13:50:05 +00:00
|
|
|
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.enabled"));
|
2019-08-29 12:57:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
name = "primary",
|
|
|
|
desc = "Set the right click brush",
|
|
|
|
descFooter = "Set the right click brush"
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.brush.primary")
|
|
|
|
public void primary(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.setSecondary(tool.getSecondary());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
name = "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());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
name = "visualize",
|
|
|
|
aliases = {"visual", "vis"},
|
|
|
|
desc = "Toggle between different visualization modes",
|
|
|
|
descFooter = "Toggle between different visualization modes\n" +
|
|
|
|
"0 = No visualization\n" +
|
|
|
|
"1 = Single block at target position\n" +
|
|
|
|
"2 = Glass showing what blocks will be changed"
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.brush.visualize")
|
2019-10-23 16:58:36 +00:00
|
|
|
public void visual(Player player, LocalSession session,
|
2019-11-20 00:11:54 +00:00
|
|
|
@Arg(name = "mode", desc = "int", def = "0") @Range(from = 0, to = 2)
|
2019-10-23 16:58:36 +00:00
|
|
|
int mode)
|
2019-08-29 12:57:03 +00:00
|
|
|
throws WorldEditException {
|
|
|
|
BrushTool tool = session.getBrushTool(player, false);
|
|
|
|
if (tool == null) {
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
2019-08-29 12:57:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
VisualMode[] modes = VisualMode.values();
|
|
|
|
VisualMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
|
|
|
|
tool.setVisualMode(player, newMode);
|
2019-12-16 09:01:41 +00:00
|
|
|
player.print(Caption.of("fawe.worldedit.brush.brush.visual.mode.set" , newMode));
|
2019-08-29 12:57:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
name = "target",
|
|
|
|
aliases = {"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) {
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
2019-08-29 12:57:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
TargetMode[] modes = TargetMode.values();
|
|
|
|
TargetMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
|
|
|
|
tool.setTargetMode(newMode);
|
2019-12-16 09:01:41 +00:00
|
|
|
player.print(Caption.of("fawe.worldedit.brush.brush.target.mode.set" , newMode));
|
2019-08-29 12:57:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
name = "targetoffset",
|
|
|
|
aliases = {"to"},
|
|
|
|
desc = "Set the targeting mask"
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.brush.targetoffset")
|
|
|
|
public void targetOffset(Player player, EditSession editSession, LocalSession session,
|
|
|
|
int offset) throws WorldEditException {
|
|
|
|
BrushTool tool = session.getBrushTool(player, false);
|
|
|
|
if (tool == null) {
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
2019-08-29 12:57:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
tool.setTargetOffset(offset);
|
2019-12-16 09:01:41 +00:00
|
|
|
player.print(Caption.of("fawe.worldedit.brush.brush.target.offset.set" , offset));
|
2019-08-29 12:57:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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 = "TODO")
|
|
|
|
boolean offHand,
|
2019-10-23 14:44:13 +00:00
|
|
|
@Arg(desc = "Target Modes", def = "none")
|
|
|
|
Scroll.Action mode,
|
2019-08-29 12:57:03 +00:00
|
|
|
@Arg(desc = "The scroll action", variable = true)
|
|
|
|
List<String> commandStr) throws WorldEditException {
|
|
|
|
BrushTool bt = session.getBrushTool(player, false);
|
|
|
|
if (bt == null) {
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
2019-08-29 12:57:03 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-10-23 14:44:13 +00:00
|
|
|
|
2019-08-29 12:57:03 +00:00
|
|
|
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
2019-10-23 14:44:13 +00:00
|
|
|
Scroll action = Scroll.fromArguments(bt, player, session, mode, commandStr, true);
|
2019-08-29 12:57:03 +00:00
|
|
|
settings.setScrollAction(action);
|
2019-10-23 14:44:13 +00:00
|
|
|
if (mode == Scroll.Action.NONE) {
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.scroll.action.unset"));
|
2019-08-29 12:57:03 +00:00
|
|
|
} else if (action != null) {
|
2019-10-23 14:44:13 +00:00
|
|
|
String full = (mode.name().toLowerCase() + " " + StringMan.join(commandStr, " ")).trim();
|
|
|
|
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
|
2019-12-16 09:01:41 +00:00
|
|
|
player.print(Caption.of("fawe.worldedit.brush.brush.scroll.action.set" , mode));
|
2019-08-29 12:57:03 +00:00
|
|
|
}
|
|
|
|
bt.update();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@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 = "TODO")
|
|
|
|
boolean offHand,
|
|
|
|
Arguments arguments) throws WorldEditException {
|
|
|
|
BrushTool tool = session.getBrushTool(player, false);
|
|
|
|
if (tool == null) {
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
2019-08-29 12:57:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (maskArg == null) {
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.source.mask.disabled"));
|
2019-08-29 12:57:03 +00:00
|
|
|
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();
|
2019-11-21 19:56:10 +00:00
|
|
|
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.source.mask"));
|
2019-08-29 12:57:03 +00:00
|
|
|
}
|
|
|
|
|
2020-02-05 05:37:42 +00:00
|
|
|
// TODO: Ping @MattBDev to reimplement 2020-02-04
|
|
|
|
// @Command(
|
|
|
|
// name = "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 = "TODO")
|
|
|
|
// boolean offHand,
|
|
|
|
// Arguments arguments) throws WorldEditException {
|
|
|
|
// BrushTool tool = session.getBrushTool(player, false);
|
|
|
|
// if (tool == null) {
|
|
|
|
// player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// if (transform == null) {
|
|
|
|
// player.print(TranslatableComponent.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(TranslatableComponent.of("fawe.worldedit.brush.brush.transform"));
|
|
|
|
// }
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|