Interface MVDestination
-
- All Known Implementing Classes:
AnchorDestination
,BedDestination
,CannonDestination
,CustomTeleporterDestination
,ExactDestination
,InvalidDestination
,PlayerDestination
,WorldDestination
public interface MVDestination
A destination API for Multiverse Any plugin can add these to MV and when they are, any action that uses them (portals, MVTP, etc.) can use them!
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getIdentifier()
Returns the identifier or prefix that is required for this destination.org.bukkit.Location
getLocation(org.bukkit.entity.Entity entity)
Returns the location a specific entity will spawn at when being teleported to this Destination.java.lang.String
getName()
Gives you a specific name of the destination.java.lang.String
getRequiredPermission()
Returns the permissions string required to go here.java.lang.String
getType()
Gives you a general friendly description of the type of destination.org.bukkit.util.Vector
getVelocity()
Returns the velocity vector for this destination.boolean
isThisType(org.bukkit.plugin.java.JavaPlugin plugin, java.lang.String destination)
Allows you to determine if a Destination is valid for the type it thinks it is.boolean
isValid()
Returns true if the destination is valid and players will be taken to it.void
setDestination(org.bukkit.plugin.java.JavaPlugin plugin, java.lang.String destination)
Sets the destination string.java.lang.String
toString()
Returns a string that can easily be saved in the config that contains all the details needed to rebuild this destination.boolean
useSafeTeleporter()
Should the Multiverse SafeTeleporter be used?
-
-
-
Method Detail
-
getIdentifier
java.lang.String getIdentifier()
Returns the identifier or prefix that is required for this destination.Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a hash and cannot have duplicate values. Read that as your plugin cannot use 'p' because it's already used. Please check the wiki when adding a custom destination!
- Returns:
- The identifier or prefix that is required for this destination.
-
isThisType
boolean isThisType(org.bukkit.plugin.java.JavaPlugin plugin, java.lang.String destination)
Allows you to determine if a Destination is valid for the type it thinks it is.An example of this would be the exact destination. A valid string would be: e:0,0,0 where an invalid one would be e:1:2:3. The first string would return true the second would return false. This is simply a convenience method and does not even NEED to be called, but it's highly recommended if you're teleporting, but it's mainly for Multiverse Internal use.
- Parameters:
plugin
- The plugin who the type belongs to.destination
- The destination string. ex: p:MyPortal:nw- Returns:
- True if the destination is valid, false if not.
-
getLocation
org.bukkit.Location getLocation(org.bukkit.entity.Entity entity)
Returns the location a specific entity will spawn at when being teleported to this Destination.To just retrieve the location as it is stored you can just pass null, but be warned some destinations may return null back to you if you do this. It is always safer to pass an actual entity. This is used so things like minecarts can be teleported.
Do not forget to use
getVelocity()
as destinations can use this too!- Parameters:
entity
- The entity to be teleported.- Returns:
- The location of the entity.
-
getVelocity
org.bukkit.util.Vector getVelocity()
Returns the velocity vector for this destination.Plugins wishing to fully support MVDestinations MUST implement this.
- Returns:
- A vector representing the speed/direction the player should travel when arriving
-
setDestination
void setDestination(org.bukkit.plugin.java.JavaPlugin plugin, java.lang.String destination)
Sets the destination string.This should be used when you want to tell this destination object about a change in where it should take people. The destination param should be match the result from
getIdentifier()
. A valid example would be that ifgetIdentifier()
returned "ow" our destination string could be "ow:TownCenter" but could not be "p:HomePortal"- Parameters:
plugin
- The plugin who the type belongs to.destination
- The destination string. ex: p:MyPortal:nw
-
isValid
boolean isValid()
Returns true if the destination is valid and players will be taken to it.Even if destinations are in the correct format (p:MyPortal) MyPortal may not exist, and therefore this would return false.
- Returns:
- True if the destination is valid; false if not.
-
getType
java.lang.String getType()
Gives you a general friendly description of the type of destination.For example, the PlayerDestination sets this to "Player". You can use this to show where a player will be taken.
- Returns:
- A friendly string description of the type of destination.
-
getName
java.lang.String getName()
Gives you a specific name of the destination.For example, the PlayerDestination sets this to The Player's Name.
- Returns:
- A friendly string stating the name of the destination.
-
toString
java.lang.String toString()
Returns a string that can easily be saved in the config that contains all the details needed to rebuild this destination.ex: e:0,0,0:50:50
- Overrides:
toString
in classjava.lang.Object
- Returns:
- The savable config string.
-
getRequiredPermission
java.lang.String getRequiredPermission()
Returns the permissions string required to go here.ex: multiverse.access.world
NOTE: This is NOT the permission to use the teleport command.
- Returns:
- the permissions string required to go here.
-
useSafeTeleporter
boolean useSafeTeleporter()
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.
-
-