PlayerKickEvent.leaveMessage(Component leaveMessage) doesn't work with null.

Abierto
#14,455 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java
Área
backend

Línea de trabajo

The reporter traces the bug to the kick handling in paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch, where a null leave message falls back to the default. Read the PlayerList#remove overloads and how PlayerQuitEvent supplies the final message, then reproduce with a plugin that calls leaveMessage(null) on PlayerKickEvent. Done means a null leave message suppresses the broadcast without breaking the quit event.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

status: needs triage version: 26.3
Expected behavior

If I call PlayerKickEvent.leaveMessage(null), the leave message is set to null and so not sent, like it says in the description of the method.

Observed/Actual behavior

The leave message is still sent.

Steps/models to reproduce
@EventHandler
private void onPlayerKick(PlayerKickEvent event) {
    event.leaveMessage(null);
}
  1. Log in with 2 accounts
  2. Kick one of them
  3. Observe leave message still being present
Plugin and Datapack List

Replicated with only my plugin.

Paper version

This server is running Paper version 26.3-237-main@7e88a0d (2026-11-01T19:08:12Z) (Implementing API version 26.3.build.237-stable)
You are running the latest version
Previous version: 26.3-236-f119026 (MC: 26.3)

Other

During my own analysis with the debugger and browing through source in intellij I came to the conclusion that it is caused by this line, which if the leave message is null, PlayerList#remove(net.minecraft.server.level.ServerPlayer) instead uses the default leave message. Then in PlayerList#remove(net.minecraft.server.level.ServerPlayer, net.kyori.adventure.text.Component) it calls PlayerQuitEvent with the supplied leave message, and uses the leave message out of that event, so using that event still works, but it's called later and doesn't have all the context.

Lenguaje dominante
Java
Estrellas
12.8k
Forks
3.6k
Merge medio
2 d 21 h
PR fusionados (30 d)
33

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PaperMC/Paper

Todos los issues de PaperMC/Paper

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.