From 6162a47002e26c72c37c9dc7ebe9d7030f722bd1 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Sat, 21 Sep 2019 18:21:22 -0700 Subject: [PATCH] Force non-Locatable actors to use placeAtPos1 --- .../src/main/java/com/sk89q/worldedit/LocalSession.java | 8 ++++++++ .../java/com/sk89q/worldedit/session/SessionManager.java | 6 ++++++ 2 files changed, 14 insertions(+) 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 0b85b6cd2..63e915ebe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -521,6 +521,14 @@ public class LocalSession { return selector.getPrimaryPosition(); } + public void setPlaceAtPos1(boolean placeAtPos1) { + this.placeAtPos1 = placeAtPos1; + } + + public boolean isPlaceAtPos1() { + return placeAtPos1; + } + /** * Toggle placement position. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index ef346d429..4e45becca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -34,6 +34,7 @@ import com.sk89q.worldedit.command.tool.SelectionWand; import com.sk89q.worldedit.command.tool.Tool; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent; +import com.sk89q.worldedit.extension.platform.Locatable; import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.storage.JsonFileSessionStore; import com.sk89q.worldedit.session.storage.SessionStore; @@ -199,6 +200,11 @@ public class SessionManager { && (owner.hasPermission("worldedit.inventory.unrestricted") || (config.useInventoryCreativeOverride && (!(owner instanceof Player) || ((Player) owner).getGameMode() == GameModes.CREATIVE))))); + // Force non-locatable actors to use placeAtPos1 + if (!(owner instanceof Locatable)) { + session.setPlaceAtPos1(true); + } + return session; }