Fixed sending ServerData packets if the description component from the backend server is null (#1673)

This commit is contained in:
Adrian
2025-10-20 19:51:47 -05:00
committed by GitHub
parent 02cf349075
commit 7412aca81c
4 changed files with 22 additions and 11 deletions

View File

@@ -36,6 +36,7 @@ import java.util.Locale;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import net.kyori.adventure.text.Component;
/**
* Common utilities for handling server list ping results.
@@ -107,6 +108,13 @@ public class ServerListPingHandler {
if (response == fallback) {
continue;
}
if (response.getDescriptionComponent() == null) {
return response.asBuilder()
.description(Component.empty())
.build();
}
return response;
}
return fallback;

View File

@@ -87,7 +87,7 @@ public class ComponentHolder {
} catch (Exception ex) {
logger.error(
"Error converting binary component to JSON component! "
+ "Binary: " + binaryTag + " JSON: " + json, ex);
+ "Binary: " + binaryTag + " JSON: " + json, ex);
throw ex;
}
}
@@ -112,7 +112,7 @@ public class ComponentHolder {
public static BinaryTag serialize(JsonElement json) {
if (json instanceof JsonPrimitive jsonPrimitive) {
if (jsonPrimitive.isNumber()) {
if (jsonPrimitive.isNumber()) {
Number number = json.getAsNumber();
if (number instanceof Byte) {