Class AnchorDestination
- java.lang.Object
-
- com.onarandombox.MultiverseCore.destination.AnchorDestination
-
- All Implemented Interfaces:
MVDestination
public class AnchorDestination extends java.lang.Object implements MVDestination
An anchor-MVDestination
.
-
-
Constructor Summary
Constructors Constructor Description AnchorDestination()
-
Method Summary
All Methods Instance Methods Concrete 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 e)
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
public 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!
- Specified by:
getIdentifier
in interfaceMVDestination
- Returns:
- The identifier or prefix that is required for this destination.
-
getVelocity
public org.bukkit.util.Vector getVelocity()
Returns the velocity vector for this destination.Plugins wishing to fully support MVDestinations MUST implement this.
- Specified by:
getVelocity
in interfaceMVDestination
- Returns:
- A vector representing the speed/direction the player should travel when arriving
-
isThisType
public 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.
- Specified by:
isThisType
in interfaceMVDestination
- 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
public org.bukkit.Location getLocation(org.bukkit.entity.Entity e)
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
MVDestination.getVelocity()
as destinations can use this too!- Specified by:
getLocation
in interfaceMVDestination
- Parameters:
e
- The entity to be teleported.- Returns:
- The location of the entity.
-
isValid
public 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.
- Specified by:
isValid
in interfaceMVDestination
- Returns:
- True if the destination is valid; false if not.
-
setDestination
public 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
MVDestination.getIdentifier()
. A valid example would be that ifMVDestination.getIdentifier()
returned "ow" our destination string could be "ow:TownCenter" but could not be "p:HomePortal"- Specified by:
setDestination
in interfaceMVDestination
- Parameters:
plugin
- The plugin who the type belongs to.destination
- The destination string. ex: p:MyPortal:nw
-
getType
public 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.
- Specified by:
getType
in interfaceMVDestination
- Returns:
- A friendly string description of the type of destination.
-
getName
public java.lang.String getName()
Gives you a specific name of the destination.For example, the PlayerDestination sets this to The Player's Name.
- Specified by:
getName
in interfaceMVDestination
- Returns:
- A friendly string stating the name of the destination.
-
toString
public java.lang.String toString()
Description copied from interface:MVDestination
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
- Specified by:
toString
in interfaceMVDestination
- Overrides:
toString
in classjava.lang.Object
- Returns:
- The savable config string.
-
getRequiredPermission
public 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.
- Specified by:
getRequiredPermission
in interfaceMVDestination
- Returns:
- the permissions string required to go here.
-
useSafeTeleporter
public boolean useSafeTeleporter()
Should the Multiverse SafeTeleporter be used?If not, MV will blindly take people to the location specified.
- Specified by:
useSafeTeleporter
in interfaceMVDestination
- Returns:
- True if the SafeTeleporter will be used, false if not.
-
-