Exact destinations now don't use the safeTeleport check. Add API hook to allow this to be configurable per destination.

This commit is contained in:
Eric Stokes 2011-08-25 19:31:46 -06:00
parent 319567eb67
commit 8c45d0b76a
7 changed files with 33 additions and 1 deletions

View File

@ -260,7 +260,12 @@ public class MVTeleport {
this.plugin.log(Level.FINER, "Entity tried to teleport to an invalid destination");
return false;
}
Location safeLoc = this.getSafeLocation(e, d);
Location safeLoc = d.getLocation(e);
if(d.useSafeTeleporter()) {
safeLoc = this.getSafeLocation(e, d);
}
if (safeLoc != null) {
e.teleport(safeLoc);
if (!d.getVelocity().equals(new Vector(0, 0, 0))) {

View File

@ -167,4 +167,9 @@ public class CannonDestination implements MVDestination {
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
@Override
public boolean useSafeTeleporter() {
return true;
}
}

View File

@ -162,4 +162,10 @@ public class ExactDestination implements MVDestination {
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
@Override
public boolean useSafeTeleporter() {
// This is an EXACT destination, don't safely teleport here.
return false;
}
}

View File

@ -56,4 +56,9 @@ public class InvalidDestination implements MVDestination {
return new Vector(0,0,0);
}
@Override
public boolean useSafeTeleporter() {
return false;
}
}

View File

@ -16,4 +16,5 @@ public interface MVDestination {
public String toString();
public String getRequiredPermission();
public Vector getVelocity();
public boolean useSafeTeleporter();
}

View File

@ -86,4 +86,9 @@ public class PlayerDestination implements MVDestination {
return new Vector(0,0,0);
}
@Override
public boolean useSafeTeleporter() {
return true;
}
}

View File

@ -115,4 +115,9 @@ public class WorldDestination implements MVDestination {
return new Vector(0,0,0);
}
@Override
public boolean useSafeTeleporter() {
return true;
}
}