Adapt ForgeWorld to LocalWorld for LocationMaskedPlayerWrapper

This commit is contained in:
Jesse Boyd 2016-10-29 22:01:55 +11:00
parent a455f22a3e
commit 1c902bfad3
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -4,7 +4,9 @@ import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldVector;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.internal.LocalWorldAdapter;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
public class LocationMaskedPlayerWrapper extends PlayerWrapper {
private Location position;
@ -38,7 +40,13 @@ public class LocationMaskedPlayerWrapper extends PlayerWrapper {
@Override
public WorldVector getPosition() {
return new WorldVector((LocalWorld) position.getExtent(), position.toVector());
LocalWorld world;
if (position.getExtent() instanceof LocalWorld) {
world = (LocalWorld) position.getExtent();
} else {
world = LocalWorldAdapter.adapt((World) position.getExtent());
}
return new WorldVector(world, position.toVector());
}
@Override