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
    Modifier and Type
    Field
    Description
    protected final T
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    DestinationInstance(T destination)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    Should 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 String
    Gets the Destination.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 String
    Serialises the destination instance to a savable string.
    String representation of the destination instance that can be deserialised back into the destination instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • destination

      protected final T extends Destination<T,I,?> destination
  • Constructor Details

    • DestinationInstance

      protected DestinationInstance(@NotNull T destination)
  • Method Details

    • getDestination

      @NotNull public T getDestination()
      Gets the destination that created this instance.
      Returns:
      The destination.
    • getIdentifier

      @NotNull public @NotNull String getIdentifier()
      Gets the Destination.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

      @NotNull public abstract @NotNull io.vavr.control.Option<String> 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

      @NotNull protected abstract @NotNull String 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

      public String toString()
      String representation of the destination instance that can be deserialised back into the destination instance.
      Overrides:
      toString in class Object
      Returns:
      The string representation of the destination instance.