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;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
public class LocationMaskedPlayerWrapper extends PlayerWrapper {
|
public class LocationMaskedPlayerWrapper extends PlayerWrapper {
|
||||||
|
private final boolean allowTeleport;
|
||||||
private Location position;
|
private Location position;
|
||||||
|
|
||||||
public LocationMaskedPlayerWrapper(Player parent, Location position) {
|
public LocationMaskedPlayerWrapper(Player parent, Location position) {
|
||||||
|
this(parent, position, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocationMaskedPlayerWrapper(Player parent, Location position, boolean allowTeleport) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
this.allowTeleport = allowTeleport;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -36,10 +42,6 @@ public class LocationMaskedPlayerWrapper extends PlayerWrapper {
|
|||||||
return WorldVector.toBlockPoint(pos.getWorld(), pos.getX(), pos.getY() - 1, pos.getZ());
|
return WorldVector.toBlockPoint(pos.getWorld(), pos.getX(), pos.getY() - 1, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPosition(Location position) {
|
|
||||||
this.position = position;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorldVector getPosition() {
|
public WorldVector getPosition() {
|
||||||
LocalWorld world;
|
LocalWorld world;
|
||||||
@ -59,5 +61,8 @@ public class LocationMaskedPlayerWrapper extends PlayerWrapper {
|
|||||||
@Override
|
@Override
|
||||||
public void setPosition(Vector pos, float pitch, float yaw) {
|
public void setPosition(Vector pos, float pitch, float yaw) {
|
||||||
this.position = new Location(position.getExtent(), pos, pitch, 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) {
|
if (fp == null) {
|
||||||
throw new IllegalArgumentException("FAWE doesn't support: " + actor);
|
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;
|
final Actor finalActor = actor;
|
||||||
if (!fp.runAction(new Runnable() {
|
if (!fp.runAction(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user