From 1eacb9126700dae16c8e85823b222e794c26c478 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 11 Jun 2020 17:26:13 -0400 Subject: [PATCH] Make extent public (unsafe) --- .../main/java/com/boydti/fawe/util/WEManager.java | 12 +++--------- .../worldedit/extent/AbstractDelegateExtent.java | 3 ++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java b/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java index d435ebb1f..3512829bc 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java @@ -33,15 +33,9 @@ public class WEManager { public void cancelEditSafe(AbstractDelegateExtent parent, FaweException reason) throws FaweException { log.warn("CancelEditSafe was hit. Please ignore this message."); - try { - final Field field = AbstractDelegateExtent.class.getDeclaredField("extent"); - field.setAccessible(true); - Extent currentExtent = parent.getExtent(); - if (!(currentExtent instanceof NullExtent)) { - field.set(parent, new NullExtent((Extent) field.get(parent), reason)); - } - } catch (Exception e) { - e.printStackTrace(); + Extent currentExtent = parent.getExtent(); + if (!(currentExtent instanceof NullExtent)) { + parent.extent = new NullExtent(parent.extent, reason); } throw reason; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index 66acf6fb0..aa0eb90a2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -59,7 +59,8 @@ public class AbstractDelegateExtent implements Extent { private static final Logger logger = LoggerFactory.getLogger(AbstractDelegateExtent.class); - private final Extent extent; + //Not safe for public usage + public Extent extent; /** * Create a new instance.