mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-07 11:20:32 +01:00
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:
parent
319567eb67
commit
8c45d0b76a
@ -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))) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -56,4 +56,9 @@ public class InvalidDestination implements MVDestination {
|
||||
return new Vector(0,0,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,4 +16,5 @@ public interface MVDestination {
|
||||
public String toString();
|
||||
public String getRequiredPermission();
|
||||
public Vector getVelocity();
|
||||
public boolean useSafeTeleporter();
|
||||
}
|
||||
|
@ -86,4 +86,9 @@ public class PlayerDestination implements MVDestination {
|
||||
return new Vector(0,0,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -115,4 +115,9 @@ public class WorldDestination implements MVDestination {
|
||||
return new Vector(0,0,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user