PlayerDoubleJumpEvent
The PlayerDoubleJumpEvent is triggered after the built-in game, spectator, cooldown, and remaining-jump checks pass, but before the double jump is consumed. Developers can cancel the jump or modify the launch velocity and cooldown.
Technical Overview
Section titled “Technical Overview”- Package:
dev.despical.tntrun.api.event.player - Parent Class:
PlayerEvent - Cancellable: Yes
Methods
Section titled “Methods”Since this event extends PlayerEvent, you have access to getPlayer() and getUser() in addition to the following:
| Method | Return Type | Description |
|---|---|---|
getGame() | Game | Returns the game where the double jump happens. |
getJumpsLeft() | int | Returns the jumps left after this jump is consumed. |
getCooldownSeconds() | double | Returns the cooldown that will be applied. |
setCooldownSeconds(double) | void | Replaces the cooldown that will be applied. |
getVelocity() | Vector | Returns the velocity that will be applied. |
setVelocity(Vector) | void | Replaces the velocity that will be applied. |
isCancelled() | boolean | Checks if the double jump has been blocked. |
setCancelled(boolean) | void | Set to true to prevent the double jump. |
Common Use Cases
Section titled “Common Use Cases”- Custom Boosters: Increase launch velocity for VIP players or special arenas.
- Cooldown Rules: Lower or raise the cooldown based on permissions.
- Anti-Abuse Checks: Cancel jumps during restricted phases or custom server events.
- Cosmetic Effects: Trigger particles, sounds, or announcements when a jump is used.
Example Usage
Section titled “Example Usage”This example gives players a stronger final double jump.
import dev.despical.tntrun.api.event.player.PlayerDoubleJumpEvent;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;
public class DoubleJumpListener implements Listener {
@EventHandler public void onDoubleJump(PlayerDoubleJumpEvent event) { if (event.getJumpsLeft() <= 1) { event.setVelocity(event.getVelocity().multiply(1.25)); event.setCooldownSeconds(2.0); } }}