Package io.papermc.paper.event.world
Class StructureLocateEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.world.WorldEvent
io.papermc.paper.event.world.StructureLocateEvent
- All Implemented Interfaces:
Cancellable
Called before a structure/feature is located.
This happens when:
- The /locate command is used.
- An Eye of Ender is used.
- An Explorer/Treasure Map is activated.
World.locateNearestStructure(Location, StructureType, int, boolean)
is invoked.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
ConstructorDescriptionStructureLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored)
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull HandlerList
Gets theLocation
from which the search is to be conducted.int
Gets the search radius in which to attempt locating the structure.Gets the location set as the structure location, if it was defined.getType()
Gets theStructureType
that is to be located.boolean
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
Sets the resultLocation
.void
setType(@NotNull StructureType type)
Sets theStructureType
that is to be located.boolean
Gets whether to search exclusively for unexplored structures.Methods inherited from class org.bukkit.event.world.WorldEvent
getWorld
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
StructureLocateEvent
-
-
Method Details
-
getHandlerList
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getResult
Gets the location set as the structure location, if it was defined.Returns
null
if it has not been set bysetResult(Location)
. Since this event fires before the search is done, the actual location is unknown at this point.- Returns:
- The result location, if it has been set. null if it has not.
- See Also:
World.locateNearestStructure(Location, StructureType, int, boolean)
-
setResult
Sets the resultLocation
. This causes the search to be skipped, and the location passed here to be used as the result.- Parameters:
result
- theLocation
of the structure.
-
getType
Gets theStructureType
that is to be located.- Returns:
- the structure type.
-
setType
Sets theStructureType
that is to be located.- Parameters:
type
- the structure type.
-
getOrigin
Gets theLocation
from which the search is to be conducted.- Returns:
Location
where search begins
-
getRadius
public int getRadius()Gets the search radius in which to attempt locating the structure.This radius may not always be obeyed during the structure search!
- Returns:
- the search radius.
-
setRadius
public void setRadius(int radius)Sets the search radius in which to attempt locating the structure.This radius may not always be obeyed during the structure search!
- Parameters:
radius
- the search radius.
-
shouldFindUnexplored
public boolean shouldFindUnexplored()Gets whether to search exclusively for unexplored structures.As with the search radius, this value is not always obeyed.
- Returns:
- Whether to search for only unexplored structures.
-
setFindUnexplored
public void setFindUnexplored(boolean findUnexplored)Sets whether to search exclusively for unexplored structures.As with the search radius, this value is not always obeyed.
- Parameters:
findUnexplored
- Whether to search for only unexplored structures.
-
isCancelled
public boolean isCancelled()Description copied from interface:Cancellable
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel)Description copied from interface:Cancellable
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-