From ffc23f40203022e8232a5d6b786ffdf6405e1304 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 31 Jul 2016 09:58:28 +1000 Subject: [PATCH] Minor PS fix + undo fastmode error --- .../bukkit/regions/PreciousStonesFeature.java | 4 ++-- .../main/java/com/boydti/fawe/FaweAPI.java | 16 ------------- .../com/boydti/fawe/object/FaweQueue.java | 2 ++ .../java/com/sk89q/worldedit/EditSession.java | 10 +++++--- .../com/sk89q/worldedit/LocalSession.java | 23 ++++++++++++------- 5 files changed, 26 insertions(+), 29 deletions(-) diff --git a/bukkit0/src/main/java/com/boydti/fawe/bukkit/regions/PreciousStonesFeature.java b/bukkit0/src/main/java/com/boydti/fawe/bukkit/regions/PreciousStonesFeature.java index 382b4780..f7e6234a 100644 --- a/bukkit0/src/main/java/com/boydti/fawe/bukkit/regions/PreciousStonesFeature.java +++ b/bukkit0/src/main/java/com/boydti/fawe/bukkit/regions/PreciousStonesFeature.java @@ -28,14 +28,14 @@ public class PreciousStonesFeature extends BukkitMaskManager implements Listener public FaweMask getMask(final FawePlayer fp) { final Player player = fp.parent; final Location location = player.getLocation(); - final List fields = PreciousStones.API().getFieldsProtectingArea(FieldFlag.PLOT, location); + final List fields = PreciousStones.API().getFieldsProtectingArea(FieldFlag.ALL, location); if (fields.isEmpty()) { return null; } String name = player.getName(); boolean member = fp.hasPermission("fawe.preciousstones.member"); for (final Field myField : fields) { - if (myField.isOwner(name) || (member && myField.getAllowed().contains(player.getName()))) { + if (myField.isOwner(name) || (member && myField.getAllAllowed().contains(player.getName()))) { BlockVector pos1 = new BlockVector(myField.getMinx(), myField.getMiny(), myField.getMinz()); BlockVector pos2 = new BlockVector(myField.getMaxx(), myField.getMaxy(), myField.getMaxz()); return new FaweMask(pos1, pos2, "FIELD: " + myField); diff --git a/core/src/main/java/com/boydti/fawe/FaweAPI.java b/core/src/main/java/com/boydti/fawe/FaweAPI.java index 34c1fe60..48e95f17 100644 --- a/core/src/main/java/com/boydti/fawe/FaweAPI.java +++ b/core/src/main/java/com/boydti/fawe/FaweAPI.java @@ -56,7 +56,6 @@ import java.util.UUID; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; import javax.annotation.Nonnull; -import org.bukkit.Location; /** * The FaweAPI class offers a few useful functions.
@@ -426,21 +425,6 @@ public class FaweAPI { return count; } - /** - * If a schematic is too large to be pasted normally
- * - Skips any block history - * - Ignores nbt - * - No, technically I haven't added proper streaming yet (WIP) - * @param file - * @param loc - * @return - */ - @Deprecated - public static void streamSchematic(final File file, final Location loc) { - final FaweLocation fl = new FaweLocation(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); - streamSchematic(file, fl); - } - /** * If a schematic is too large to be pasted normally
* - Skips any block history diff --git a/core/src/main/java/com/boydti/fawe/object/FaweQueue.java b/core/src/main/java/com/boydti/fawe/object/FaweQueue.java index 760a1070..608eacd6 100644 --- a/core/src/main/java/com/boydti/fawe/object/FaweQueue.java +++ b/core/src/main/java/com/boydti/fawe/object/FaweQueue.java @@ -291,6 +291,8 @@ public abstract class FaweQueue { } catch (FaweException ignore) { session.debug(BBC.WORLDEDIT_FAILED_LOAD_CHUNK, x >> 4, z >> 4); return def; + } catch (Throwable e) { + return 0; } } diff --git a/core/src/main/java/com/sk89q/worldedit/EditSession.java b/core/src/main/java/com/sk89q/worldedit/EditSession.java index 7fb37728..a5233253 100644 --- a/core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -531,12 +531,16 @@ public class EditSession implements Extent { } ExtentTraverser traverseHistory = new ExtentTraverser(this.extent).find(HistoryExtent.class); if (disableHistory) { - if (traverseHistory != null) { + if (traverseHistory != null && traverseHistory.exists()) { ExtentTraverser beforeHistory = traverseHistory.previous(); ExtentTraverser afterHistory = traverseHistory.next(); - beforeHistory.setNext(afterHistory.get()); + if (beforeHistory != null && beforeHistory.exists()) { + beforeHistory.setNext(afterHistory.get()); + } else { + extent = afterHistory.get(); + } } - } else if (traverseHistory == null) { + } else if (traverseHistory == null || !traverseHistory.exists()) { ExtentTraverser traverseBypass = new ExtentTraverser(this.extent).find(bypassHistory); if (traverseBypass != null) { ExtentTraverser beforeHistory = traverseBypass.previous(); diff --git a/core/src/main/java/com/sk89q/worldedit/LocalSession.java b/core/src/main/java/com/sk89q/worldedit/LocalSession.java index 8df11a51..e6065259 100644 --- a/core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit; import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard; +import com.boydti.fawe.util.EditSessionBuilder; import com.boydti.fawe.util.MainUtil; import com.sk89q.jchronic.Chronic; import com.sk89q.jchronic.Options; @@ -259,10 +260,13 @@ public class LocalSession { --historyPointer; if (historyPointer >= 0) { EditSession editSession = history.get(historyPointer); - EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() - .getEditSession(editSession.getWorld(), -1, newBlockBag, null); - newEditSession.enableQueue(); - newEditSession.setFastMode(fastMode); + EditSession newEditSession = new EditSessionBuilder(editSession.getWorld()) + .allowedRegionsEverywhere() + .checkMemory(false) + .changeSetNull() + .fastmode(true) + .limitUnlimited() + .build(); editSession.undo(newEditSession); return editSession; } else { @@ -293,10 +297,13 @@ public class LocalSession { checkNotNull(player); if (historyPointer < history.size()) { EditSession editSession = history.get(historyPointer); - EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() - .getEditSession(editSession.getWorld(), -1, newBlockBag, null); - newEditSession.enableQueue(); - newEditSession.setFastMode(fastMode); + EditSession newEditSession = new EditSessionBuilder(editSession.getWorld()) + .allowedRegionsEverywhere() + .checkMemory(false) + .changeSetNull() + .fastmode(true) + .limitUnlimited() + .build(); editSession.redo(newEditSession); ++historyPointer; return editSession;