Fix up command

This commit is contained in:
Jesse Boyd 2016-11-25 11:23:35 +11:00
parent 9c1bb58a09
commit 67f6f11bde
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 10 additions and 5 deletions

View File

@ -7,11 +7,17 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
public class LocationMaskedPlayerWrapper extends PlayerWrapper {
private final boolean allowTeleport;
private Location position;
public LocationMaskedPlayerWrapper(Player parent, Location position) {
this(parent, position, false);
}
public LocationMaskedPlayerWrapper(Player parent, Location position, boolean allowTeleport) {
super(parent);
this.position = position;
this.allowTeleport = allowTeleport;
}
@Override
@ -36,10 +42,6 @@ public class LocationMaskedPlayerWrapper extends PlayerWrapper {
return WorldVector.toBlockPoint(pos.getWorld(), pos.getX(), pos.getY() - 1, pos.getZ());
}
public void setPosition(Location position) {
this.position = position;
}
@Override
public WorldVector getPosition() {
LocalWorld world;
@ -59,5 +61,8 @@ public class LocationMaskedPlayerWrapper extends PlayerWrapper {
@Override
public void setPosition(Vector pos, float pitch, float yaw) {
this.position = new Location(position.getExtent(), pos, pitch, yaw);
if (allowTeleport) {
super.setPosition(pos, pitch, yaw);
}
}
}

View File

@ -239,7 +239,7 @@ public final class CommandManager {
if (fp == null) {
throw new IllegalArgumentException("FAWE doesn't support: " + actor);
}
locals.put(Actor.class, actor instanceof Player ? (actor = new LocationMaskedPlayerWrapper((Player) actor, ((Player) actor).getLocation())) : actor);
locals.put(Actor.class, actor instanceof Player ? (actor = new LocationMaskedPlayerWrapper((Player) actor, ((Player) actor).getLocation(), true)) : actor);
final Actor finalActor = actor;
if (!fp.runAction(new Runnable() {
@Override