public class StructureLocateEvent extends WorldEvent implements Cancellable
World.locateNearestStructure(Location, StructureType, int, boolean)
is invoked.Event.Result
Constructor and Description |
---|
StructureLocateEvent(@NotNull World world,
@NotNull Location origin,
@NotNull StructureType structureType,
int radius,
boolean findUnexplored) |
Modifier and Type | Method and Description |
---|---|
static @NotNull HandlerList |
getHandlerList() |
@NotNull HandlerList |
getHandlers() |
@NotNull Location |
getOrigin()
Gets the
Location from which the search is to be conducted. |
int |
getRadius()
Gets the search radius in which to attempt locating the structure.
|
@Nullable Location |
getResult()
Gets the location set as the structure location, if it was defined.
|
@NotNull StructureType |
getType()
Gets the
StructureType that is to be located. |
boolean |
isCancelled()
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel)
Sets the cancellation state of this event.
|
void |
setFindUnexplored(boolean findUnexplored)
Sets whether to search exclusively for unexplored structures.
|
void |
setRadius(int radius)
Sets the search radius in which to attempt locating the structure.
|
void |
setResult(@Nullable Location result)
Sets the result
Location . |
void |
setType(@NotNull StructureType type)
Sets the
StructureType that is to be located. |
boolean |
shouldFindUnexplored()
Gets whether to search exclusively for unexplored structures.
|
getWorld
callEvent, getEventName, isAsynchronous
@NotNull public static @NotNull HandlerList getHandlerList()
@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@Nullable public @Nullable Location getResult()
Returns null
if it has not been set by setResult(Location)
.
Since this event fires before the search is done, the actual location is unknown at this point.
World.locateNearestStructure(Location, StructureType, int, boolean)
public void setResult(@Nullable @Nullable Location result)
Location
. This causes the search to be skipped, and the location passed here to be used as the result.result
- the Location
of the structure.@NotNull public @NotNull StructureType getType()
StructureType
that is to be located.public void setType(@NotNull @NotNull StructureType type)
StructureType
that is to be located.type
- the structure type.@NotNull public @NotNull Location getOrigin()
Location
from which the search is to be conducted.Location
where search beginspublic int getRadius()
This radius may not always be obeyed during the structure search!
public void setRadius(int radius)
This radius may not always be obeyed during the structure search!
radius
- the search radius.public boolean shouldFindUnexplored()
As with the search radius, this value is not always obeyed.
public void setFindUnexplored(boolean findUnexplored)
As with the search radius, this value is not always obeyed.
findUnexplored
- Whether to search for only unexplored structures.public boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this eventCopyright © 2021. All rights reserved.