NullPointerException when setting flag to "none" in RegionCommands.setFlag

Abierto Apto para principiantes
#2,305 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java
Área
cli

Línea de trabajo

Comienza en RegionCommands.setFlag y sigue el tratamiento que hace el comando de flag /rg de su valor de retorno cuando el argumento del flag es none. Reproduce el problema con los comandos de región y de flag proporcionados y, después, verifica que borrar el flag se siga guardando correctamente y produzca la salida de confirmación estándar sin una NullPointerException.

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

Descripción

status:pending type:bug
WorldEdit Version

7.4.5+7590-b8dc4c1

WorldGuard Version

7.0.18+2392-fa605e6

Platform Version

Purpur 26.2-2627-HEAD@f284e3d

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

When setting a WorldGuard flag to none to remove it, the plugin successfully clears the flag and saves the data in the background, but throws a NullPointerException in the server console/chat. This happens because the command framework attempts to invoke .toString() on the null value returned by RegionCommands.setFlag(...) to build the console/chat feedback.

Copy from the log:

[20:25:40] [Server thread/INFO]: Cannot invoke "Object.toString()" because the return value of "com.sk89q.worldguard.commands.region.RegionCommands.setFlag(com.sk89q.worldguard.protection.regions.ProtectedRegion, com.sk89q.worldguard.protection.flags.Flag, com.sk89q.worldedit.extension.platform.Actor, String)" is null --   | [20:25:44] [WorldGuard Region I/O/INFO]: [WorldGuard] Region data changes made in 'world' have been background saved
Expected Behavior

The plugin should successfully clear the flag, gracefully handle the null return value from the cleared state, and send a standard confirmation message without throwing any errors in the console.

Reproduction Steps
  1. Create a region and assign a flag to a specific value (e.g., /rg flag testregion exit deny).
  2. Attempt to remove the flag by setting it to none (e.g., /rg flag testregion exit none).
  3. Check the server console to observe the Cannot invoke "Object.toString()" ... is null error, followed by the background save message.
Optional WorldGuard-Report

No response

Anything Else?

No response

Lenguaje dominante
Java
Estrellas
939
Forks
672
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

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 EngineHub/WorldGuard

Todos los issues de EngineHub/WorldGuard

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.