Fix up command
This commit is contained in:
parent
9c1bb58a09
commit
67f6f11bde
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user