PaperMC / PaperMC/Paper

VehicleExitEvent is called after teleporting when done via performCommand while the player is sneaking

Open
#12,911 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage version: 1.21.8
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

VehicleExitEvent being called before being teleported via player.performCommand("minecraft:tp ~5 ~ ~") in the PlayerInputEvent for when the player is sneaking

Observed/Actual behavior

when doing player.performCommand("minecraft:tp ~5 ~ ~") inside the PlayerInputEvent with event.getInput().isSneak() the player already teleported when checking the location via the VehicleExitEvent and therefore area limitations aren't working.

Steps/models to reproduce
    @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
    public void onPlayerInBoatGetsDamaged(PlayerInputEvent e) {
        if(e.getInput().isSneak()) e.getPlayer().performCommand("tp ~5 ~ ~");
    }

    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
    public void onPlayerTryExitBoat(VehicleExitEvent e) {
        // this doesn't cancel when teleporting via the performCommand above since the location already changed
        if(e.getVehicle().getLocation().distance(e.getExited().getLocation()) < 3) e.setCancelled(true); 
    }
Plugin and Datapack List

Plugins:

ℹ Server Plugins (4):
Bukkit Plugins:
- HubMinigames, LuckPerms, WorldEdit, WorldGuard

Datapacks:

There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]
There are no more data packs available
Paper version

This server is running Paper version 1.21.8-17-main@dbc367b (2025-07-26T21:53:33Z) (Implementing API version 1.21.8-R0.1-SNAPSHOT)
You are 3 version(s) behind
Download the new version at: https://papermc.io/downloads/paper
Previous version: 1.21.4-232-12d8fe0 (MC: 1.21.4)

Other

this is probably partly because i run the command in the input event when the event.getInput().isSneak() = true

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the interaction between PlayerInputEvent, player.performCommand("minecraft:tp ~5 ~ ~"), and VehicleExitEvent while sneaking. Trace the event ordering and location values, then verify that the relevant exit-area cancellation behavior is preserved when teleporting through the command.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.