geforkt von Mirrors/FastAsyncWorldEdit
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
Dieser Commit ist enthalten in:
Commit
c050132737
@ -64,17 +64,17 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
this.world = (CraftWorld) world;
|
this.world = (CraftWorld) world;
|
||||||
this.X = X;
|
this.X = X;
|
||||||
this.Z = Z;
|
this.Z = Z;
|
||||||
if (forceLoad) {
|
// if (forceLoad) {
|
||||||
this.world.getHandle().setForceLoaded(X, Z, this.forceLoad = true);
|
// this.world.getHandle().setForceLoaded(X, Z, this.forceLoad = true);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
protected void finalize() {
|
// protected void finalize() {
|
||||||
if (forceLoad) {
|
// if (forceLoad) {
|
||||||
this.world.getHandle().setForceLoaded(X, Z, forceLoad = false);
|
// this.world.getHandle().setForceLoaded(X, Z, forceLoad = false);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiomeType(int x, int z) {
|
public BiomeType getBiomeType(int x, int z) {
|
||||||
|
@ -44,10 +44,12 @@ import com.sk89q.worldedit.registry.state.PropertyKey;
|
|||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
|
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent.Builder;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent.Builder;
|
||||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
@ -72,6 +74,8 @@ import java.util.function.Consumer;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.xml.soap.Text;
|
||||||
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
@ -1234,12 +1238,34 @@ public class CFICommands {
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
protected static void mainMenu(Player player) {
|
protected static void mainMenu(Player player) {
|
||||||
//TODO
|
TextComponentProducer producer = new TextComponentProducer();
|
||||||
// msg("What do you want to do now?").append(newline())
|
producer.append(TextComponent.of("What do you want to do now?"));
|
||||||
// .cmdOptions("/cfi ", "", "Coloring", "Component", "Populate", "Brush")
|
producer.newline();
|
||||||
// .append(newline()).text("<> [View]").command("/cfi " + Commands.getAlias(CFICommands.class, "download")).tooltip("View full resolution image")
|
String prefix = "/cfi ";
|
||||||
// .append(newline()).text(">< [Cancel]").cmdTip("/cfi " + Commands.getAlias(CFICommands.class, "cancel"))
|
String[] options = {"Coloring", "Component", "Populate", "Brush"};
|
||||||
// .append(newline()).text("&2>> [Done]").cmdTip("/cfi " + Commands.getAlias(CFICommands.class, "done"))
|
for (int i = 0; i < options.length; i++) {
|
||||||
// .send(fp);
|
if (i != 0) {
|
||||||
|
producer.append(TextComponent.of(" | ", TextColor.DARK_GRAY));
|
||||||
|
}
|
||||||
|
String option = options[i];
|
||||||
|
String cmd = prefix + option;
|
||||||
|
producer.append(TextComponent.of(option, TextColor.GREEN)
|
||||||
|
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, cmd))
|
||||||
|
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(option))));
|
||||||
|
}
|
||||||
|
producer.newline();
|
||||||
|
producer.newline().append(TextComponent.of("<> [View]", TextColor.DARK_AQUA)
|
||||||
|
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "download"))
|
||||||
|
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("View full res image"))));
|
||||||
|
|
||||||
|
producer.newline().append(TextComponent.of(">< [Cancel]", TextColor.RED)
|
||||||
|
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "cancel"))
|
||||||
|
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("cancel"))));
|
||||||
|
|
||||||
|
producer.newline().append(TextComponent.of(">> [Done]", TextColor.DARK_GREEN)
|
||||||
|
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "done"))
|
||||||
|
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("done"))));
|
||||||
|
|
||||||
|
player.print(producer.create());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.boydti.fawe.object.brush;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
import com.boydti.fawe.object.brush.scroll.Scroll;
|
||||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -48,7 +48,7 @@ public class BrushSettings {
|
|||||||
private Pattern material;
|
private Pattern material;
|
||||||
private Expression size = new Expression(1);
|
private Expression size = new Expression(1);
|
||||||
private Set<String> permissions;
|
private Set<String> permissions;
|
||||||
private ScrollAction scrollAction;
|
private Scroll scrollAction;
|
||||||
private String lastWorld;
|
private String lastWorld;
|
||||||
|
|
||||||
public BrushSettings() {
|
public BrushSettings() {
|
||||||
@ -107,7 +107,7 @@ public class BrushSettings {
|
|||||||
}
|
}
|
||||||
if (settings.containsKey(SettingType.SCROLL_ACTION.name())) {
|
if (settings.containsKey(SettingType.SCROLL_ACTION.name())) {
|
||||||
String actionArgs = (String) settings.get(SettingType.SCROLL_ACTION.name());
|
String actionArgs = (String) settings.get(SettingType.SCROLL_ACTION.name());
|
||||||
ScrollAction action = ScrollAction.fromArguments(tool, player, session, actionArgs, false);
|
Scroll action = Scroll.fromArguments(tool, player, session, actionArgs, false);
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
bs.setScrollAction(action);
|
bs.setScrollAction(action);
|
||||||
bs.constructor.put(SettingType.SCROLL_ACTION, actionArgs);
|
bs.constructor.put(SettingType.SCROLL_ACTION, actionArgs);
|
||||||
@ -194,7 +194,7 @@ public class BrushSettings {
|
|||||||
return setSize(new Expression(size));
|
return setSize(new Expression(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BrushSettings setScrollAction(ScrollAction scrollAction) {
|
public BrushSettings setScrollAction(Scroll scrollAction) {
|
||||||
if (scrollAction == null) constructor.remove(SettingType.SCROLL_ACTION);
|
if (scrollAction == null) constructor.remove(SettingType.SCROLL_ACTION);
|
||||||
this.scrollAction = scrollAction;
|
this.scrollAction = scrollAction;
|
||||||
return this;
|
return this;
|
||||||
@ -260,7 +260,7 @@ public class BrushSettings {
|
|||||||
return Collections.unmodifiableSet(permissions);
|
return Collections.unmodifiableSet(permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScrollAction getScrollAction() {
|
public Scroll getScrollAction() {
|
||||||
return scrollAction;
|
return scrollAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,37 +2,54 @@ package com.boydti.fawe.object.brush.scroll;
|
|||||||
|
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class ScrollAction implements ScrollTool {
|
public abstract class Scroll implements ScrollTool {
|
||||||
private BrushTool tool;
|
private BrushTool tool;
|
||||||
|
|
||||||
public static ScrollAction fromArguments(BrushTool tool, Player player, LocalSession session, String arguments, boolean message) throws InputParseException {
|
public enum Action {
|
||||||
|
NONE,
|
||||||
|
CLIPBOARD,
|
||||||
|
MASK,
|
||||||
|
PATTERN,
|
||||||
|
TARGET_OFFSET,
|
||||||
|
RANGE,
|
||||||
|
SIZE,
|
||||||
|
TARGET
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Scroll fromArguments(BrushTool tool, Player player, LocalSession session, String actionArgs, boolean message) {
|
||||||
|
String[] split = actionArgs.split(" ");
|
||||||
|
Action mode = Action.valueOf(split[0].toUpperCase());
|
||||||
|
List<String> args = Arrays.asList(Arrays.copyOfRange(split, 1, split.length));
|
||||||
|
return fromArguments(tool, player, session, mode, args, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static com.boydti.fawe.object.brush.scroll.Scroll fromArguments(BrushTool tool, Player player, LocalSession session, Action mode, List<String> arguments, boolean message) throws InputParseException {
|
||||||
ParserContext parserContext = new ParserContext();
|
ParserContext parserContext = new ParserContext();
|
||||||
parserContext.setActor(player);
|
parserContext.setActor(player);
|
||||||
parserContext.setWorld(player.getWorld());
|
parserContext.setWorld(player.getWorld());
|
||||||
parserContext.setSession(session);
|
parserContext.setSession(session);
|
||||||
String[] split = arguments.split(" ");
|
switch (mode) {
|
||||||
switch (split[0].toLowerCase()) {
|
case NONE:
|
||||||
case "none":
|
|
||||||
return null;
|
return null;
|
||||||
case "clipboard":
|
case CLIPBOARD:
|
||||||
if (split.length != 2) {
|
if (arguments.size() != 2) {
|
||||||
if (message) BBC.COMMAND_SYNTAX.send(player, "clipboard [file]");
|
if (message) BBC.COMMAND_SYNTAX.send(player, "clipboard [file]");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String filename = split[1];
|
String filename = arguments.get(1);
|
||||||
try {
|
try {
|
||||||
MultiClipboardHolder multi = ClipboardFormats.loadAllFromInput(player, filename, null, message);
|
MultiClipboardHolder multi = ClipboardFormats.loadAllFromInput(player, filename, null, message);
|
||||||
if (multi == null) {
|
if (multi == null) {
|
||||||
@ -42,35 +59,35 @@ public abstract class ScrollAction implements ScrollTool {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
case "mask":
|
case MASK:
|
||||||
if (split.length < 2) {
|
if (arguments.size() < 2) {
|
||||||
if (message) BBC.COMMAND_SYNTAX.send(player, "mask [mask 1] [mask 2] [mask 3]...");
|
if (message) BBC.COMMAND_SYNTAX.send(player, "mask [mask 1] [mask 2] [mask 3]...");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Mask[] masks = new Mask[split.length - 1];
|
Mask[] masks = new Mask[arguments.size() - 1];
|
||||||
for (int i = 1; i < split.length; i++) {
|
for (int i = 1; i < arguments.size(); i++) {
|
||||||
String arg = split[i];
|
String arg = arguments.get(i);
|
||||||
masks[i - 1] = WorldEdit.getInstance().getMaskFactory().parseFromInput(arg, parserContext);
|
masks[i - 1] = WorldEdit.getInstance().getMaskFactory().parseFromInput(arg, parserContext);
|
||||||
}
|
}
|
||||||
return (new ScrollMask(tool, masks));
|
return (new ScrollMask(tool, masks));
|
||||||
case "pattern":
|
case PATTERN:
|
||||||
if (split.length < 2) {
|
if (arguments.size() < 2) {
|
||||||
if (message) BBC.COMMAND_SYNTAX.send(player, "pattern [pattern 1] [pattern 2] [pattern 3]...");
|
if (message) BBC.COMMAND_SYNTAX.send(player, "pattern [pattern 1] [pattern 2] [pattern 3]...");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Pattern[] patterns = new Pattern[split.length - 1];
|
Pattern[] patterns = new Pattern[arguments.size() - 1];
|
||||||
for (int i = 1; i < split.length; i++) {
|
for (int i = 1; i < arguments.size(); i++) {
|
||||||
String arg = split[i];
|
String arg = arguments.get(i);
|
||||||
patterns[i - 1] = WorldEdit.getInstance().getPatternFactory().parseFromInput(arg, parserContext);
|
patterns[i - 1] = WorldEdit.getInstance().getPatternFactory().parseFromInput(arg, parserContext);
|
||||||
}
|
}
|
||||||
return (new ScrollPattern(tool, patterns));
|
return (new ScrollPattern(tool, patterns));
|
||||||
case "targetoffset":
|
case TARGET_OFFSET:
|
||||||
return (new ScrollTargetOffset(tool));
|
return (new ScrollTargetOffset(tool));
|
||||||
case "range":
|
case RANGE:
|
||||||
return (new ScrollRange(tool));
|
return (new ScrollRange(tool));
|
||||||
case "size":
|
case SIZE:
|
||||||
return (new ScrollSize(tool));
|
return (new ScrollSize(tool));
|
||||||
case "target":
|
case TARGET:
|
||||||
return (new ScrollTarget(tool));
|
return (new ScrollTarget(tool));
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -78,7 +95,7 @@ public abstract class ScrollAction implements ScrollTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScrollAction(BrushTool tool) {
|
public Scroll(BrushTool tool) {
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
}
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ import com.sk89q.worldedit.entity.Player;
|
|||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ScrollClipboard extends ScrollAction {
|
public class ScrollClipboard extends Scroll {
|
||||||
private final List<ClipboardHolder> clipboards;
|
private final List<ClipboardHolder> clipboards;
|
||||||
private final LocalSession session;
|
private final LocalSession session;
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
|
@ -5,7 +5,7 @@ import com.sk89q.worldedit.command.tool.BrushTool;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
|
|
||||||
public class ScrollMask extends ScrollAction {
|
public class ScrollMask extends Scroll {
|
||||||
private final Mask[] masks;
|
private final Mask[] masks;
|
||||||
private int index;
|
private int index;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import com.sk89q.worldedit.command.tool.BrushTool;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
|
|
||||||
public class ScrollPattern extends ScrollAction {
|
public class ScrollPattern extends Scroll {
|
||||||
private final Pattern[] patterns;
|
private final Pattern[] patterns;
|
||||||
private int index;
|
private int index;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import com.sk89q.worldedit.WorldEdit;
|
|||||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
|
||||||
public class ScrollRange extends ScrollAction {
|
public class ScrollRange extends Scroll {
|
||||||
public ScrollRange(BrushTool tool) {
|
public ScrollRange(BrushTool tool) {
|
||||||
super(tool);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import com.sk89q.worldedit.WorldEdit;
|
|||||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
|
||||||
public class ScrollSize extends ScrollAction {
|
public class ScrollSize extends Scroll {
|
||||||
public ScrollSize(BrushTool tool) {
|
public ScrollSize(BrushTool tool) {
|
||||||
super(tool);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.boydti.fawe.util.MathMan;
|
|||||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
|
||||||
public class ScrollTarget extends ScrollAction {
|
public class ScrollTarget extends Scroll {
|
||||||
public ScrollTarget(BrushTool tool) {
|
public ScrollTarget(BrushTool tool) {
|
||||||
super(tool);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package com.boydti.fawe.object.brush.scroll;
|
package com.boydti.fawe.object.brush.scroll;
|
||||||
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
|
||||||
public class ScrollTargetOffset extends ScrollAction {
|
public class ScrollTargetOffset extends Scroll {
|
||||||
public ScrollTargetOffset(BrushTool tool) {
|
public ScrollTargetOffset(BrushTool tool) {
|
||||||
super(tool);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ import com.sk89q.worldedit.math.transform.Transform;
|
|||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
|
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
|
||||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
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.Component;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||||
@ -649,7 +650,7 @@ public class SchematicCommands {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextComponent.Builder msg = TextComponent.builder();
|
TextComponentProducer msg = new TextComponentProducer();
|
||||||
|
|
||||||
msg.append(TextComponent.of(" - ", color));
|
msg.append(TextComponent.of(" - ", color));
|
||||||
|
|
||||||
@ -663,21 +664,27 @@ public class SchematicCommands {
|
|||||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Add to clipboard"))));
|
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Add to clipboard"))));
|
||||||
}
|
}
|
||||||
if (type != UtilityCommands.URIType.DIRECTORY) {
|
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) {
|
} 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);
|
TextComponent msgElem = TextComponent.of(name, color);
|
||||||
if (type != UtilityCommands.URIType.DIRECTORY) {
|
if (type != UtilityCommands.URIType.DIRECTORY) {
|
||||||
msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, loadSingle + " " + path))
|
msgElem = msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, loadSingle + " " + path));
|
||||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Load")));
|
msgElem = msgElem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Load")));
|
||||||
} else {
|
} else {
|
||||||
msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, list + " " + path))
|
msgElem = msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, list + " " + path));
|
||||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("List")));
|
msgElem = msgElem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("List")));
|
||||||
}
|
}
|
||||||
msg.append(msgElem);
|
msg.append(msgElem);
|
||||||
|
|
||||||
return msg.build();
|
return msg.create();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
PaginationBox paginationBox = PaginationBox.fromStrings("Available schematics", pageCommand, components);
|
PaginationBox paginationBox = PaginationBox.fromStrings("Available schematics", pageCommand, components);
|
||||||
|
@ -20,26 +20,14 @@
|
|||||||
package com.sk89q.worldedit.command;
|
package com.sk89q.worldedit.command;
|
||||||
|
|
||||||
import com.boydti.fawe.config.BBC;
|
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.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.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
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.BlockDataCyler;
|
||||||
import com.sk89q.worldedit.command.tool.BlockReplacer;
|
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.DistanceWand;
|
||||||
import com.sk89q.worldedit.command.tool.FloatingTreeRemover;
|
import com.sk89q.worldedit.command.tool.FloatingTreeRemover;
|
||||||
import com.sk89q.worldedit.command.tool.FloodFillTool;
|
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.CommandPermissions;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
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.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.HandSide;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
import com.sk89q.worldedit.util.TreeGenerator;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
import org.enginehub.piston.annotation.param.Switch;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
public class ToolCommands {
|
public class ToolCommands {
|
||||||
|
@ -22,7 +22,7 @@ package com.sk89q.worldedit.command;
|
|||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.object.brush.BrushSettings;
|
import com.boydti.fawe.object.brush.BrushSettings;
|
||||||
import com.boydti.fawe.object.brush.TargetMode;
|
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.brush.visualization.VisualMode;
|
||||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
@ -330,24 +330,25 @@ public class ToolUtilCommands {
|
|||||||
public void scroll(Player player, EditSession editSession, LocalSession session,
|
public void scroll(Player player, EditSession editSession, LocalSession session,
|
||||||
@Switch(name = 'h', desc = "TODO")
|
@Switch(name = 'h', desc = "TODO")
|
||||||
boolean offHand,
|
boolean offHand,
|
||||||
@Arg(desc = "Target Modes")
|
@Arg(desc = "Target Modes", def = "none")
|
||||||
String modes,
|
Scroll.Action mode,
|
||||||
@Arg(desc = "The scroll action", variable = true)
|
@Arg(desc = "The scroll action", variable = true)
|
||||||
List<String> commandStr) throws WorldEditException {
|
List<String> commandStr) throws WorldEditException {
|
||||||
// TODO NOT IMPLEMENTED Convert ScrollAction to an argument converter
|
|
||||||
BrushTool bt = session.getBrushTool(player, false);
|
BrushTool bt = session.getBrushTool(player, false);
|
||||||
if (bt == null) {
|
if (bt == null) {
|
||||||
player.print(BBC.BRUSH_NONE.s());
|
player.print(BBC.BRUSH_NONE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
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);
|
settings.setScrollAction(action);
|
||||||
if (modes.equalsIgnoreCase("none")) {
|
if (mode == Scroll.Action.NONE) {
|
||||||
BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
|
BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
|
||||||
} else if (action != null) {
|
} else if (action != null) {
|
||||||
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, modes);
|
String full = (mode.name().toLowerCase() + " " + StringMan.join(commandStr, " ")).trim();
|
||||||
BBC.BRUSH_SCROLL_ACTION_SET.send(player, modes);
|
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
|
||||||
|
BBC.BRUSH_SCROLL_ACTION_SET.send(player, mode);
|
||||||
}
|
}
|
||||||
bt.update();
|
bt.update();
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command.argument;
|
package com.sk89q.worldedit.command.argument;
|
||||||
|
|
||||||
|
import com.boydti.fawe.object.brush.scroll.Scroll;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.command.util.HookMode;
|
import com.sk89q.worldedit.command.util.HookMode;
|
||||||
@ -49,6 +50,8 @@ public final class EnumConverter {
|
|||||||
null));
|
null));
|
||||||
commandManager.registerConverter(Key.of(HookMode.class),
|
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) {
|
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.MovableTool;
|
||||||
import com.boydti.fawe.object.brush.ResettableTool;
|
import com.boydti.fawe.object.brush.ResettableTool;
|
||||||
import com.boydti.fawe.object.brush.TargetMode;
|
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.scroll.ScrollTool;
|
||||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||||
import com.boydti.fawe.object.brush.visualization.VisualMode;
|
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);
|
this.getContext().setScrollAction(scrollAction);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -603,7 +603,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
@Override
|
@Override
|
||||||
public boolean increment(Player player, int amount) {
|
public boolean increment(Player player, int amount) {
|
||||||
BrushSettings current = getContext();
|
BrushSettings current = getContext();
|
||||||
ScrollAction tmp = current.getScrollAction();
|
Scroll tmp = current.getScrollAction();
|
||||||
if (tmp != null) {
|
if (tmp != null) {
|
||||||
tmp.setTool(this);
|
tmp.setTool(this);
|
||||||
if (tmp.increment(player, amount)) {
|
if (tmp.increment(player, amount)) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren