Class DestinationInstance<I extends DestinationInstance<I,T>,T extends Destination<T,I,?>>
java.lang.Object
org.mvplugins.multiverse.core.destination.DestinationInstance<I,T>
- Type Parameters:
I- The type of the instance.T- The type of the destination.
- Direct Known Subclasses:
AnchorDestinationInstance,BedDestinationInstance,CannonDestinationInstance,ExactDestinationInstance,PlayerDestinationInstance,WorldDestinationInstance
public abstract class DestinationInstance<I extends DestinationInstance<I,T>,T extends Destination<T,I,?>>
extends Object
Instance of a specific
Destination. This class may be persisted through the lifetime of the server. Thus,
you should ensure location stored will still work after world unload and loads again. See UnloadedWorldLocation
for a possible implementation of such location.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanShould the Multiverse SafeTeleporter be used?Gets the destination that created this instance.abstract @NotNull io.vavr.control.Option<String> Gets the permission suffix to check for when teleporting to this destination.@NotNull StringGets theDestination.getIdentifier()for this instance.abstract @NotNull io.vavr.control.Option<org.bukkit.Location> getLocation(@NotNull org.bukkit.entity.Entity teleportee) Gets the exact location to teleport an entity to.abstract @NotNull io.vavr.control.Option<org.bukkit.util.Vector> getVelocity(@NotNull org.bukkit.entity.Entity teleportee) Gets the velocity to apply to an entity after teleporting.protected abstract @NotNull StringSerialises the destination instance to a savable string.toString()String representation of the destination instance that can be deserialised back into the destination instance.
-
Field Details
-
destination
-
-
Constructor Details
-
DestinationInstance
-
-
Method Details
-
getDestination
Gets the destination that created this instance.- Returns:
- The destination.
-
getIdentifier
Gets theDestination.getIdentifier()for this instance.- Returns:
- The identifier.
-
getLocation
@NotNull public abstract @NotNull io.vavr.control.Option<org.bukkit.Location> getLocation(@NotNull @NotNull org.bukkit.entity.Entity teleportee) Gets the exact location to teleport an entity to. It is recommended return a copy of the location, as the returned location may be modified by other api's that calls this method.- Parameters:
teleportee- The entity to teleport.- Returns:
- The location to teleport to.
-
getVelocity
@NotNull public abstract @NotNull io.vavr.control.Option<org.bukkit.util.Vector> getVelocity(@NotNull @NotNull org.bukkit.entity.Entity teleportee) Gets the velocity to apply to an entity after teleporting. It is recommended return a copy of the vector, as the returned vector may be modified by other api's that calls this method.- Parameters:
teleportee- The entity to teleport.- Returns:
- A vector representing the speed/direction the player should travel when arriving at the destination.
-
checkTeleportSafety
public abstract boolean checkTeleportSafety()Should the Multiverse SafeTeleporter be used?If not, MV will blindly take people to the location specified.
- Returns:
- True if the SafeTeleporter will be used, false if not.
-
getFinerPermissionSuffix
Gets the permission suffix to check for when teleporting to this destination. This is used for finer per world/player permissions, such as "multiverse.teleport.self.worldname".For example, if the destination is "w:world", the permission suffix is "world".
- Returns:
- The permission suffix.
-
serialise
Serialises the destination instance to a savable string.This is used when plugins save destinations to configuration, and when the destination is displayed to the user.
- Returns:
- The serialised destination instance.
-
toString
String representation of the destination instance that can be deserialised back into the destination instance.
-