From 938dde68b2fb7b2a7e9297a80bf3b64284a202b3 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 23 Oct 2019 16:44:36 +0100 Subject: [PATCH] Don't force load didn't realize this loads the chunk, I just need to delay unloading until the operation is complete --- .../adapter/mc1_14/BukkitGetBlocks_1_14.java | 18 +++++++------- .../fawe/object/brush/scroll/Scroll.java | 8 +++++++ .../worldedit/command/SchematicCommands.java | 24 ++++++++++++------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java index 79e21ed7d..5cede4c10 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java @@ -64,17 +64,17 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { this.world = (CraftWorld) world; this.X = X; this.Z = Z; - if (forceLoad) { - this.world.getHandle().setForceLoaded(X, Z, this.forceLoad = true); - } +// if (forceLoad) { +// this.world.getHandle().setForceLoaded(X, Z, this.forceLoad = true); +// } } - @Override - protected void finalize() { - if (forceLoad) { - this.world.getHandle().setForceLoaded(X, Z, forceLoad = false); - } - } +// @Override +// protected void finalize() { +// if (forceLoad) { +// this.world.getHandle().setForceLoaded(X, Z, forceLoad = false); +// } +// } @Override public BiomeType getBiomeType(int x, int z) { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/scroll/Scroll.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/scroll/Scroll.java index 684fb817a..b0d3dd25a 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/scroll/Scroll.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/scroll/Scroll.java @@ -12,6 +12,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; import java.io.IOException; +import java.util.Arrays; import java.util.List; public abstract class Scroll implements ScrollTool { @@ -28,6 +29,13 @@ public abstract class Scroll implements ScrollTool { 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 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 arguments, boolean message) throws InputParseException { ParserContext parserContext = new ParserContext(); parserContext.setActor(player); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index f5e311e77..d6ac9c34a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -52,6 +52,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; @@ -59,7 +60,6 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent; import com.sk89q.worldedit.util.formatting.text.format.TextColor; import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.file.FilenameException; -import org.checkerframework.checker.nullness.qual.NonNull; import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.CommandContainer; import org.enginehub.piston.annotation.param.Arg; @@ -649,7 +649,7 @@ public class SchematicCommands { break; } - TextComponent.Builder msg = TextComponent.builder(); + TextComponentProducer msg = new TextComponentProducer(); msg.append(TextComponent.of(" - ", color)); @@ -663,21 +663,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);