Package sawfowl.commandpack.api
Interface RandomTeleportService
public interface RandomTeleportService
A tool for getting random positions in the world.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
These teleportation options to a random position must be used to find a position. -
Method Summary
Modifier and TypeMethodDescriptionCreate new random teleport options.Default teleportation options.
The method always returns a copy from the plugin configuration.getLocation
(ServerLocation currentLocation, RandomTeleportService.RandomTeleportOptions options) Search for a teleportation position in the target world.getLocationFuture
(ServerLocation currentLocation, RandomTeleportService.RandomTeleportOptions options) Search for a teleportation position in the target world.
Async mode.getOptions
(ResourceKey worldKey) Getting options from the plugin configuration for the specified world.
If no world is found, the default options will be selected.
The method always returns a copy from the plugin configuration.getOptions
(ServerWorld world) Getting options from the plugin configuration for the specified world.
If no world is found, the default options will be selected.
The method always returns a copy from the plugin configuration.
-
Method Details
-
getLocation
Optional<ServerLocation> getLocation(ServerLocation currentLocation, RandomTeleportService.RandomTeleportOptions options) Search for a teleportation position in the target world.- Parameters:
currentLocation
- - The current location of the entity.options
- - Options for finding a random position.- Returns:
ServerLocation
-
getLocationFuture
CompletableFuture<Optional<ServerLocation>> getLocationFuture(ServerLocation currentLocation, RandomTeleportService.RandomTeleportOptions options) Search for a teleportation position in the target world.
Async mode. Teleportation is only possible in the main thread.
Despite the asynchrony, a large number of attempts to find a location can crash the server.- Parameters:
currentLocation
- - The current location of the entity.options
- - Options for finding a random position.- Returns:
ServerLocation
-
getOptions
Getting options from the plugin configuration for the specified world.
If no world is found, the default options will be selected.
The method always returns a copy from the plugin configuration. Changing the copy will not affect the original values. -
getOptions
Getting options from the plugin configuration for the specified world.
If no world is found, the default options will be selected.
The method always returns a copy from the plugin configuration. Changing the copy will not affect the original values. -
getDefault
RandomTeleportService.RandomTeleportOptions getDefault()Default teleportation options.
The method always returns a copy from the plugin configuration. Changing the copy will not affect the original values. -
createOptions
Create new random teleport options.
-