PaperMC / PaperMC/Paper

Incorrect nullablility at PlayerMoveEvent.getTo()

Open
#8,827 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

resolution: awaiting response type: bug
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

PlayerMoveEvent has subclasses like PlayerTeleportEvent and PlayerPortalEvent where getTo() can return null, so PlayerMoveEvent.getTo() must be nullable.

https://github.com/PaperMC/Paper/blob/master/patches/api/0176-Fix-Spigot-annotation-mistakes.patch#L473

Observed/Actual behavior

is not

Steps/models to reproduce

Create a handler for a PlayerPortalEvent, check if getTo() returns null and get a warning

Plugin and Datapack List

no

Paper version

yes

Other

No response

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 with patches/api/0176-Fix-Spigot-annotation-mistakes.patch around line 473 and inspect PlayerMoveEvent.getTo() together with the PlayerTeleportEvent and PlayerPortalEvent subclasses. Update the nullability annotation so handlers can safely account for a null return, then verify the API warning is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.