Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
TravelAgent.java
1 package org.bukkit;
2 
3 /**
4  * The Travel Agent handles the creation and the research of Nether and End
5  * portals when Entities try to use one.
6  * <p>
7  * It is used in {@link org.bukkit.event.entity.EntityPortalEvent} and in
8  * {@link org.bukkit.event.player.PlayerPortalEvent} to help developers
9  * reproduce and/or modify Vanilla behaviour.
10  */
11 public interface TravelAgent {
12 
13  /**
14  * Set the Block radius to search in for available portals.
15  *
16  * @param radius the radius in which to search for a portal from the
17  * location
18  * @return this travel agent
19  */
20  public TravelAgent setSearchRadius(int radius);
21 
22  /**
23  * Gets the search radius value for finding an available portal.
24  *
25  * @return the currently set search radius
26  */
27  public int getSearchRadius();
28 
29  /**
30  * Sets the maximum radius from the given location to create a portal.
31  *
32  * @param radius the radius in which to create a portal from the location
33  * @return this travel agent
34  */
35  public TravelAgent setCreationRadius(int radius);
36 
37  /**
38  * Gets the maximum radius from the given location to create a portal.
39  *
40  * @return the currently set creation radius
41  */
42  public int getCreationRadius();
43 
44  /**
45  * Returns whether the TravelAgent will attempt to create a destination
46  * portal or not.
47  *
48  * @return whether the TravelAgent should create a destination portal or
49  * not
50  */
51  public boolean getCanCreatePortal();
52 
53  /**
54  * Sets whether the TravelAgent should attempt to create a destination
55  * portal or not.
56  *
57  * @param create Sets whether the TravelAgent should create a destination
58  * portal or not
59  */
60  public void setCanCreatePortal(boolean create);
61 
62  /**
63  * Attempt to find a portal near the given location, if a portal is not
64  * found it will attempt to create one.
65  *
66  * @param location the location where the search for a portal should begin
67  * @return the location of a portal which has been found or returns the
68  * location passed to the method if unsuccessful
69  * @see #createPortal(Location)
70  */
71  public Location findOrCreate(Location location);
72 
73  /**
74  * Attempt to find a portal near the given location.
75  *
76  * @param location the desired location of the portal
77  * @return the location of the nearest portal to the location
78  */
79  public Location findPortal(Location location);
80 
81  /**
82  * Attempt to create a portal near the given location.
83  * <p>
84  * In the case of a Nether portal teleportation, this will attempt to
85  * create a Nether portal.
86  * <p>
87  * In the case of an Ender portal teleportation, this will (re-)create the
88  * obsidian platform and clean blocks above it.
89  *
90  * @param location the desired location of the portal
91  * @return true if a portal was successfully created
92  */
93  public boolean createPortal(Location location);
94 }
TravelAgent setCreationRadius(int radius)
void setCanCreatePortal(boolean create)
Location findOrCreate(Location location)
boolean createPortal(Location location)
boolean getCanCreatePortal()
Location findPortal(Location location)
TravelAgent setSearchRadius(int radius)