Force non-Locatable actors to use placeAtPos1

This commit is contained in:
Kenzie Togami 2019-09-21 18:21:22 -07:00
parent 44dc926c49
commit 6162a47002
No known key found for this signature in database
GPG Key ID: 5D200B325E157A81
2 changed files with 14 additions and 0 deletions

View File

@ -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.
*

View File

@ -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;
}