mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Merge branch 'commanding-pipeline' of https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13 into commanding-pipeline
Conflicts: worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
This commit is contained in:
@ -56,6 +56,7 @@ import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
@ -649,7 +650,7 @@ public class SchematicCommands {
|
||||
break;
|
||||
}
|
||||
|
||||
TextComponent.Builder msg = TextComponent.builder();
|
||||
TextComponentProducer msg = new TextComponentProducer();
|
||||
|
||||
msg.append(TextComponent.of(" - ", color));
|
||||
|
||||
@ -663,21 +664,27 @@ public class SchematicCommands {
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Add to clipboard"))));
|
||||
}
|
||||
if (type != UtilityCommands.URIType.DIRECTORY) {
|
||||
msg.append(TextComponent.of("[X]", TextColor.DARK_RED).clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, delete + " " + path)));
|
||||
msg.append(TextComponent.of("[X]", TextColor.DARK_RED)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, delete + " " + path))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("delete")))
|
||||
);
|
||||
} else if (hasShow) {
|
||||
msg.append(TextComponent.of("[O]", TextColor.DARK_AQUA).clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, showCmd + " " + path)));
|
||||
msg.append(TextComponent.of("[O]", TextColor.DARK_AQUA)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, showCmd + " " + path))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("visualize")))
|
||||
);
|
||||
}
|
||||
TextComponent msgElem = TextComponent.of(name, color);
|
||||
if (type != UtilityCommands.URIType.DIRECTORY) {
|
||||
msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, loadSingle + " " + path))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Load")));
|
||||
msgElem = msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, loadSingle + " " + path));
|
||||
msgElem = msgElem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Load")));
|
||||
} else {
|
||||
msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, list + " " + path))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("List")));
|
||||
msgElem = msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, list + " " + path));
|
||||
msgElem = msgElem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("List")));
|
||||
}
|
||||
msg.append(msgElem);
|
||||
|
||||
return msg.build();
|
||||
return msg.create();
|
||||
}
|
||||
});
|
||||
PaginationBox paginationBox = PaginationBox.fromStrings("Available schematics", pageCommand, components);
|
||||
|
@ -20,26 +20,14 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.boydti.fawe.object.brush.InspectBrush;
|
||||
import com.boydti.fawe.object.brush.TargetMode;
|
||||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
||||
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;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.command.argument.Arguments;
|
||||
import com.sk89q.worldedit.command.tool.BlockDataCyler;
|
||||
import com.sk89q.worldedit.command.tool.BlockReplacer;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.tool.DistanceWand;
|
||||
import com.sk89q.worldedit.command.tool.FloatingTreeRemover;
|
||||
import com.sk89q.worldedit.command.tool.FloodFillTool;
|
||||
@ -51,22 +39,13 @@ import com.sk89q.worldedit.command.tool.TreePlanter;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ToolCommands {
|
||||
|
@ -22,7 +22,7 @@ package com.sk89q.worldedit.command;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.boydti.fawe.object.brush.TargetMode;
|
||||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
||||
import com.boydti.fawe.object.brush.scroll.Scroll;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualMode;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -330,24 +330,25 @@ public class ToolUtilCommands {
|
||||
public void scroll(Player player, EditSession editSession, LocalSession session,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
@Arg(desc = "Target Modes")
|
||||
String modes,
|
||||
@Arg(desc = "Target Modes", def = "none")
|
||||
Scroll.Action mode,
|
||||
@Arg(desc = "The scroll action", variable = true)
|
||||
List<String> commandStr) throws WorldEditException {
|
||||
// TODO NOT IMPLEMENTED Convert ScrollAction to an argument converter
|
||||
BrushTool bt = session.getBrushTool(player, false);
|
||||
if (bt == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
return;
|
||||
}
|
||||
|
||||
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
||||
ScrollAction action = ScrollAction.fromArguments(bt, player, session, StringMan.join(commandStr, " "), true);
|
||||
Scroll action = Scroll.fromArguments(bt, player, session, mode, commandStr, true);
|
||||
settings.setScrollAction(action);
|
||||
if (modes.equalsIgnoreCase("none")) {
|
||||
if (mode == Scroll.Action.NONE) {
|
||||
BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
|
||||
} else if (action != null) {
|
||||
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, modes);
|
||||
BBC.BRUSH_SCROLL_ACTION_SET.send(player, modes);
|
||||
String full = (mode.name().toLowerCase() + " " + StringMan.join(commandStr, " ")).trim();
|
||||
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
|
||||
BBC.BRUSH_SCROLL_ACTION_SET.send(player, mode);
|
||||
}
|
||||
bt.update();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.argument;
|
||||
|
||||
import com.boydti.fawe.object.brush.scroll.Scroll;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.command.util.HookMode;
|
||||
@ -48,7 +49,9 @@ public final class EnumConverter {
|
||||
r -> ImmutableSet.of(r.getDisplayName()),
|
||||
null));
|
||||
commandManager.registerConverter(Key.of(HookMode.class),
|
||||
basic(HookMode.class));
|
||||
basic(HookMode.class));
|
||||
commandManager.registerConverter(Key.of(Scroll.Action.class),
|
||||
basic(Scroll.Action.class));
|
||||
}
|
||||
|
||||
private static <E extends Enum<E>> ArgumentConverter<E> basic(Class<E> enumClass) {
|
||||
|
@ -28,7 +28,7 @@ import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.boydti.fawe.object.brush.MovableTool;
|
||||
import com.boydti.fawe.object.brush.ResettableTool;
|
||||
import com.boydti.fawe.object.brush.TargetMode;
|
||||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
||||
import com.boydti.fawe.object.brush.scroll.Scroll;
|
||||
import com.boydti.fawe.object.brush.scroll.ScrollTool;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualMode;
|
||||
@ -555,7 +555,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
|
||||
|
||||
public void setScrollAction(ScrollAction scrollAction) {
|
||||
public void setScrollAction(Scroll scrollAction) {
|
||||
this.getContext().setScrollAction(scrollAction);
|
||||
update();
|
||||
}
|
||||
@ -603,7 +603,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
@Override
|
||||
public boolean increment(Player player, int amount) {
|
||||
BrushSettings current = getContext();
|
||||
ScrollAction tmp = current.getScrollAction();
|
||||
Scroll tmp = current.getScrollAction();
|
||||
if (tmp != null) {
|
||||
tmp.setTool(this);
|
||||
if (tmp.increment(player, amount)) {
|
||||
|
Reference in New Issue
Block a user