NullPointerException on PlayerTeleportEvent when a player disconnects while riding (regression from #2325)
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza leyendo Session.testMoveTo y el manejo de la salida en PlayerMoveListener.onPlayerQuit; el informe sigue el teletransporte posterior a través de WorldGuardPlayerListener.onPlayerTeleport e identifica que lastValid es null después de la desinicialización. Comprueba las pruebas existentes del movimiento de la sesión, si las hay, y añade cobertura para un teletransporte después de la desinicialización. El trabajo estará terminado cuando desconectarse mientras se monta ya no registre la NullPointerException.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
WorldEdit Version
7.4.7-SNAPSHOT+130688b5d
WorldGuard Version
7.0.22-SNAPSHOT+488d94d6
Platform Version
Paper 26.3-DEV-main@13565bc (current main); also seen on our production server with main@df120fd
Confirmations
- I am using the most recent Minecraft release.
- I am using a version of WorldEdit compatible with my Minecraft version.
- I am using a version of WorldGuard compatible with my Minecraft version.
- I am using the latest or recommended version of my platform software.
- I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
- I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)
Bug Description
Since #2325 (d9a8ca5, included in 7.0.21), Session.uninitialize() sets lastValid to null. PlayerMoveListener.onPlayerQuit calls uninitialize(), but when the quitting player is riding a vehicle alone, the server dismounts them afterwards in PlayerList.remove() (stopRiding → dismountTo → teleportTo). That fires a PlayerTeleportEvent, and WorldGuardPlayerListener.onPlayerTeleport → Session.testMoveTo → Locations.isDifferentBlock(lastValid, to) throws a NullPointerException on the null lastValid.
Every disconnect while riding logs this error with a full stack trace (4 times in one afternoon on our server). We saw no gameplay effect: the session is re-initialised on the next join and the vehicle is still saved with the player.
Expected Behavior
No error when a player disconnects while riding: the dismount teleport that follows the quit should be ignored once the session has been uninitialised.
Reproduction Steps
- Paper 26.3 with only WorldEdit and WorldGuard installed (default configs, no regions).
- Join and ride a vehicle as its only player passenger, e.g.
/summon minecraft:oak_boat ~ ~ ~then/ride <player> mount @e[type=minecraft:oak_boat,limit=1,sort=nearest], or simply board a boat. - Disconnect while still riding.
- The console logs
Could not pass event PlayerTeleportEvent to WorldGuardwith the NullPointerException below. Disconnecting without riding logs nothing.
Optional WorldGuard-Report
No response
Anything Else?
Reproduced on a clean server (only WorldEdit and WorldGuard, Paper main@13565bc) with a bot that rides a boat and disconnects; a control bot that disconnects without riding logs nothing. Stack trace from the clean server (tick frames trimmed):
[23:01:15 INFO]: rider lost connection: Disconnected
[23:01:15 ERROR]: Could not pass event PlayerTeleportEvent to WorldGuard v7.0.22-SNAPSHOT+488d94d6
java.lang.NullPointerException: Cannot invoke "com.sk89q.worldedit.util.Location.getBlockX()" because "a" is null
at WorldGuard.jar//com.sk89q.worldguard.util.Locations.isDifferentBlock(Locations.java:37) ~[?:?]
at WorldGuard.jar//com.sk89q.worldguard.session.Session.testMoveTo(Session.java:236) ~[?:?]
at WorldGuard.jar//com.sk89q.worldguard.session.Session.testMoveTo(Session.java:209) ~[?:?]
at WorldGuard.jar//com.sk89q.worldguard.bukkit.listener.WorldGuardPlayerListener.onPlayerTeleport(WorldGuardPlayerListener.java:409) ~[?:?]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:71) ~[paper-api-26.3.local-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:52) ~[paper-26.3.jar:26.3-DEV-13565bc]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-26.3.jar:26.3-DEV-13565bc]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:627) ~[paper-api-26.3.local-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.teleport(ServerGamePacketListenerImpl.java:1939) ~[paper-26.3.jar:26.3-DEV-13565bc]
at net.minecraft.server.level.ServerPlayer.teleportTo(ServerPlayer.java:2314) ~[paper-26.3.jar:26.3-DEV-13565bc]
at net.minecraft.server.level.ServerPlayer.dismountTo(ServerPlayer.java:2303) ~[paper-26.3.jar:26.3-DEV-13565bc]
at net.minecraft.world.entity.LivingEntity.dismountVehicle(LivingEntity.java:2973) ~[paper-26.3.jar:26.3-DEV-13565bc]
at net.minecraft.world.entity.LivingEntity.stopRiding(LivingEntity.java:3989) ~[paper-26.3.jar:26.3-DEV-13565bc]
at net.minecraft.world.entity.Entity.stopRiding(Entity.java:3501) ~[paper-26.3.jar:26.3-DEV-13565bc]
at net.minecraft.server.players.PlayerList.remove(PlayerList.java:475) ~[paper-26.3.jar:26.3-DEV-13565bc]
at net.minecraft.server.players.PlayerList.remove(PlayerList.java:435) ~[paper-26.3.jar:26.3-DEV-13565bc]
at net.minecraft.server.network.ServerGamePacketListenerImpl.removePlayerFromWorld(ServerGamePacketListenerImpl.java:2355) ~[paper-26.3.jar:26.3-DEV-13565bc]
A possible fix: treat an uninitialised session as nothing to test, e.g. return null from Session.testMoveTo while lastValid is null.
- Lenguaje dominante
- Java
- Estrellas
- 943
- Forks
- 688
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 7
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de EngineHub/WorldGuard
-
End Crystal explosion gets fully cancelled even if a small part of the explosion affects a protected areaPosiblemente ocupada @Almost10 la tomó hace 2 días. Abiertostatus:pending type:bug
Dificultad 3/5 Medio día Aptitud para principiantes 62/100
EngineHub/WorldGuard#2323 · 4 comentarios ·
Los mantenedores suelen responder en 3 días
-
status:pending type:feature-request
Dificultad 3/5 1-2 días Aptitud para principiantes 54/100
EngineHub/WorldGuard#2320 ·
Los mantenedores suelen responder en 3 días
-
Entity Mob-cap memory leakAbiertostatus:pending type:bug
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
EngineHub/WorldGuard#2314 · 3 comentarios ·
Los mantenedores suelen responder en 3 días
-
status:pending type:bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
EngineHub/WorldGuard#2302 · 4 comentarios ·
Los mantenedores suelen responder en 3 días
-
status:pending type:feature-request
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
EngineHub/WorldGuard#2301 · 5 comentarios ·
Los mantenedores suelen responder en 3 días
Todos los issues de EngineHub/WorldGuard
Issues similares
-
Mend: dependency security vulnerability
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
needs-area-label
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 2 días
-
critical
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
enhancement Java macOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
freerouting/freerouting#1079 ·
Los mantenedores suelen responder en 4 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día