From 4050cf238f577d2f5c18003260c78926f7f7bd93 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 25 Aug 2021 15:48:39 +0100 Subject: [PATCH] Fix #1217 --- .../main/java/com/sk89q/worldedit/LocalSession.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index d9c3a4489..711e1ae29 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -576,7 +576,10 @@ public class LocalSession implements TextureHolder { public EditSession undo(@Nullable BlockBag newBlockBag, Actor actor) { checkNotNull(actor); //FAWE start - use our logic - World world = ((Player) actor).getWorldForEditing(); + World world = (actor instanceof Player) ? ((Player) actor).getWorldForEditing() : getWorldOverride(); + if (world == null) { + throw new MissingWorldException(); + } loadSessionHistoryFromDisk(actor.getUniqueId(), world); if (getHistoryNegativeIndex() < history.size()) { ChangeSet changeSet = getChangeSet(history.get(getHistoryIndex())); @@ -617,7 +620,10 @@ public class LocalSession implements TextureHolder { //FAWE start - use our logic public EditSession redo(@Nullable BlockBag newBlockBag, Actor actor) { checkNotNull(actor); - World world = ((Player) actor).getWorldForEditing(); + World world = (actor instanceof Player) ? ((Player) actor).getWorldForEditing() : getWorldOverride(); + if (world == null) { + throw new MissingWorldException(); + } loadSessionHistoryFromDisk(actor.getUniqueId(), world); if (getHistoryNegativeIndex() > 0) { setDirty();