Fixed sending ServerData packets if the description component from the backend server is null (#1673)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user