Package org.bukkit
Interface TravelAgent
public interface TravelAgent
The Travel Agent handles the creation and the research of Nether and End
portals when Entities try to use one.
It is used in EntityPortalEvent and in
PlayerPortalEvent to help developers
reproduce and/or modify Vanilla behaviour.
-
Method Summary
Modifier and Type Method Description booleancreatePortal(Location location)Attempt to create a portal near the given location.LocationfindOrCreate(Location location)Attempt to find a portal near the given location, if a portal is not found it will attempt to create one.LocationfindPortal(Location location)Attempt to find a portal near the given location.booleangetCanCreatePortal()Returns whether the TravelAgent will attempt to create a destination portal or not.intgetCreationRadius()Gets the maximum radius from the given location to create a portal.intgetSearchRadius()Gets the search radius value for finding an available portal.voidsetCanCreatePortal(boolean create)Sets whether the TravelAgent should attempt to create a destination portal or not.TravelAgentsetCreationRadius(int radius)Sets the maximum radius from the given location to create a portal.TravelAgentsetSearchRadius(int radius)Set the Block radius to search in for available portals.
-
Method Details
-
setSearchRadius
Set the Block radius to search in for available portals.- Parameters:
radius- the radius in which to search for a portal from the location- Returns:
- this travel agent
-
getSearchRadius
int getSearchRadius()Gets the search radius value for finding an available portal.- Returns:
- the currently set search radius
-
setCreationRadius
Sets the maximum radius from the given location to create a portal.- Parameters:
radius- the radius in which to create a portal from the location- Returns:
- this travel agent
-
getCreationRadius
int getCreationRadius()Gets the maximum radius from the given location to create a portal.- Returns:
- the currently set creation radius
-
getCanCreatePortal
boolean getCanCreatePortal()Returns whether the TravelAgent will attempt to create a destination portal or not.- Returns:
- whether the TravelAgent should create a destination portal or not
-
setCanCreatePortal
void setCanCreatePortal(boolean create)Sets whether the TravelAgent should attempt to create a destination portal or not.- Parameters:
create- Sets whether the TravelAgent should create a destination portal or not
-
findOrCreate
Attempt to find a portal near the given location, if a portal is not found it will attempt to create one.- Parameters:
location- the location where the search for a portal should begin- Returns:
- the location of a portal which has been found or returns the location passed to the method if unsuccessful
- See Also:
createPortal(Location)
-
findPortal
Attempt to find a portal near the given location.- Parameters:
location- the desired location of the portal- Returns:
- the location of the nearest portal to the location
-
createPortal
Attempt to create a portal near the given location.In the case of a Nether portal teleportation, this will attempt to create a Nether portal.
In the case of an Ender portal teleportation, this will (re-)create the obsidian platform and clean blocks above it.
- Parameters:
location- the desired location of the portal- Returns:
- true if a portal was successfully created
-