RealmsServerList .java

com.mojang.realmsclient.dto.RealmsServerList (record, 30 lines): members: servers, parse, LOGGER. strings: "Could not parse McoServerList", "servers".

com.mojang.realmsclient.dtorecord30 linescommon966 B

Implements

API Surface (1)

RealmsServerList parse(final GuardedSerializer gson, final String json)

Fields & Constants (1)

LOGGER

String literals (2)

"servers"
"Could not parse McoServerList"

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

RealmsServerList.java30 lines · Minecraft 26.3 · verbatim
1
package com.mojang.realmsclient.dto;
2
3
import com.google.gson.annotations.SerializedName;
4
import com.mojang.logging.LogUtils;
5
import java.util.List;
6
import net.fabricmc.api.EnvType;
7
import net.fabricmc.api.Environment;
8
import org.slf4j.Logger;
9
10
@Environment(EnvType.CLIENT)
11
public record RealmsServerList(@SerializedName("servers") List<RealmsServer> servers) implements ReflectionBasedSerialization {
12
	private static final Logger LOGGER = LogUtils.getLogger();
13
14
	public static RealmsServerList parse(final GuardedSerializer gson, final String json) {
15
		try {
16
			RealmsServerList realmsServerList = gson.fromJson(json, RealmsServerList.class);
17
			if (realmsServerList != null) {
18
				realmsServerList.servers.forEach(RealmsServer::finalize);
19
				return realmsServerList;
20
			}
21
22
			LOGGER.error("Could not parse McoServerList: {}", json);
23
		} catch (Exception e) {
24
			LOGGER.error("Could not parse McoServerList", e);
25
		}
26
27
		return new RealmsServerList(List.of());
28
	}
29
}
30

Decompiled Minecraft 26.3 source of RealmsServerList (com/mojang/realmsclient/dto/RealmsServerList.java) with Mojang official mappings, stored verbatim on the site.