Interface SkyDropService
This is the reusable half of Zentrix's own arrival: find a point with real ground under it, inside the world border, with enough free air beneath to glide through, then place the player there and start their glider. Anything that wants to insert a player from above — a late join, a revival, a scenario that scatters the survivors again — can use it instead of inventing its own search and hoping the point it picked is not inside a mountain or outside the border.
Every method touches worlds, chunks and players and must be called on the Bukkit main thread.
Searching can load chunks, so keep SkyDropRequest.attempts() modest for points far from
anything already loaded.
Example
SkyDropService drops = ZentrixAPI.get().getSkyDropService();
SkyDropRequest request = SkyDropRequest.above(arena.getWorldBorder().getCenter())
.withinRadius(64)
.atAltitude(80);
drops.findDropPoint(request).ifPresent(point -> drops.drop(player, point, true));
- Since:
- 1.6.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull SkyDropResultdrop(@NotNull org.bukkit.entity.Player player, @NotNull SkyDropRequest request, boolean deployGlider) Finds a drop point and places the player at it in one step.@NotNull SkyDropResultdrop(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Location dropPoint, boolean deployGlider) Places a player at a drop point and optionally starts their glider.@NotNull Optional<org.bukkit.Location> findDropPoint(@NotNull SkyDropRequest request) Looks for a point matching the request.
-
Method Details
-
findDropPoint
@NotNull @NotNull Optional<org.bukkit.Location> findDropPoint(@NotNull @NotNull SkyDropRequest request) Looks for a point matching the request.The anchor's own column is tried first, so a request with no radius either yields the point above the anchor or nothing. Empty means the area cannot offer a drop at all: no ground, not enough air above it, or nothing inside the border.
- Parameters:
request- the area to drop into- Returns:
- a drop point, or empty when the area offers none
-
drop
@NotNull @NotNull SkyDropResult drop(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.Location dropPoint, boolean deployGlider) Places a player at a drop point and optionally starts their glider.The player is taken off any vehicle first, so the drop is never swallowed by whatever they were riding. Asking for a glider on a server without Matrix Gliders places the player anyway and reports
SkyDropResult.PLACED_WITHOUT_GLIDER.- Parameters:
player- the player to movedropPoint- where to put them, normally fromfindDropPoint(SkyDropRequest)deployGlider- whether to start their glider once they are there- Returns:
- what happened
-
drop
@NotNull default @NotNull SkyDropResult drop(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull SkyDropRequest request, boolean deployGlider) Finds a drop point and places the player at it in one step.- Returns:
SkyDropResult.FAILEDwhen the request yielded no point
-