2011-06-18 00:59:14 +01:00
|
|
|
package org.bukkit;
|
|
|
|
|
2013-09-10 21:02:53 -05:00
|
|
|
/**
|
|
|
|
* The Travel Agent handles the creation and the research of Nether and End
|
|
|
|
* portals when Entities try to use one.
|
|
|
|
* <p>
|
|
|
|
* It is used in {@link org.bukkit.event.entity.EntityPortalEvent} and in
|
|
|
|
* {@link org.bukkit.event.player.PlayerPortalEvent} to help developers
|
|
|
|
* reproduce and/or modify Vanilla behaviour.
|
|
|
|
*/
|
2011-06-18 00:59:14 +01:00
|
|
|
public interface TravelAgent {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Block radius to search in for available portals.
|
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @param radius the radius in which to search for a portal from the
|
|
|
|
* location
|
|
|
|
* @return this travel agent
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public TravelAgent setSearchRadius(int radius);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the search radius value for finding an available portal.
|
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @return the currently set search radius
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public int getSearchRadius();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the maximum radius from the given location to create a portal.
|
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @param radius the radius in which to create a portal from the location
|
|
|
|
* @return this travel agent
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public TravelAgent setCreationRadius(int radius);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the maximum radius from the given location to create a portal.
|
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @return the currently set creation radius
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public int getCreationRadius();
|
|
|
|
|
|
|
|
/**
|
2013-09-10 21:02:53 -05:00
|
|
|
* Returns whether the TravelAgent will attempt to create a destination
|
|
|
|
* portal or not.
|
2011-06-18 00:59:14 +01:00
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @return whether the TravelAgent should create a destination portal or
|
|
|
|
* not
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public boolean getCanCreatePortal();
|
|
|
|
|
|
|
|
/**
|
2013-09-10 21:02:53 -05:00
|
|
|
* Sets whether the TravelAgent should attempt to create a destination
|
|
|
|
* portal or not.
|
2011-06-18 00:59:14 +01:00
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @param create Sets whether the TravelAgent should create a destination
|
|
|
|
* portal or not
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public void setCanCreatePortal(boolean create);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 21:02:53 -05:00
|
|
|
* Attempt to find a portal near the given location, if a portal is not
|
|
|
|
* found it will attempt to create one.
|
2011-06-18 00:59:14 +01:00
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @param location the location where the search for a portal should begin
|
|
|
|
* @return the location of a portal which has been found or returns the
|
|
|
|
* location passed to the method if unsuccessful
|
|
|
|
* @see #createPortal(Location)
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public Location findOrCreate(Location location);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attempt to find a portal near the given location.
|
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @param location the desired location of the portal
|
|
|
|
* @return the location of the nearest portal to the location
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public Location findPortal(Location location);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attempt to create a portal near the given location.
|
2013-09-10 21:02:53 -05:00
|
|
|
* <p>
|
|
|
|
* In the case of a Nether portal teleportation, this will attempt to
|
|
|
|
* create a Nether portal.
|
|
|
|
* <p>
|
|
|
|
* In the case of an Ender portal teleportation, this will (re-)create the
|
|
|
|
* obsidian platform and clean blocks above it.
|
2011-12-25 16:02:30 +01:00
|
|
|
*
|
2013-09-10 21:02:53 -05:00
|
|
|
* @param location the desired location of the portal
|
|
|
|
* @return true if a portal was successfully created
|
2011-06-18 00:59:14 +01:00
|
|
|
*/
|
|
|
|
public boolean createPortal(Location location);
|
2013-09-10 21:02:53 -05:00
|
|
|
}
|